! Perform (Perceptron Classifier in Inform) v1.0 ! Nick Montfort http://nickm.com 2004-06-25 Release 0; Constant NO_SCORE; Include "Parser"; Include "mfclass"; ! -------------------------------------------------------------------------- Object Place "Testing the Classifier" with short_name [; rfalse; ], description "Type ~WHO IS [NAME]?~ to see an Inform classifier in action.^The classifier is trained on first names recorded in the U.S. census.", has light; ! -------------------------------------------------------------------------- [ Initialise; print "^Perform (Perceptron Classifier in Inform) v1.0^"; print "Nick Montfort http://nickm.com 2004-06-25^"; PlayerTo(Place,1); ]; Verb 'who' 'is' * topic -> Whois ; [ WhoisSub i; print (char) (name_said->(i+1) - 32); for(i=1:i<(name_said->0):i++) { print (char) name_said->(i+1); } print "? I suppose "; if(ClassifyName()) { print "s"; } print "he's just some random person.^"; ]; [ BeforeParsing i j; name_said->0 = WordLength(3); if(name_said->0 > name_max) { name_said->0 = name_max; } j = 0; for(i=0:i0:i++) { if(((WordAddress(3)->i > 96) && (WordAddress(3)->i < 123)) || ((WordAddress(3)->i > 64) && (WordAddress(3)->i < 91))) { name_said->(i+1) = WordAddress(3)->i; j++; } } name_said->0 = j; ]; Include "VerbLib"; Include "Grammar"; ! END ----------------------------------------------------------------------