by Psimagus
I tend to think of a mind, be it human or artificial, as a multi-layered kind of a thing - a sort of conscious (or pseudo-conscious, in the case of bots,) laminate. And in my own bot-building (text-based at least,) these layers seem to fall into a few more or less defined categories. I didn't set out to build BJ to this specification, and I certainly didn't begin with the lowest-level keyphrases, and work my way up to the more specific and specialized ones, but I have always kept in mind that there is a natural hierarchy that emerges from regular development.
At the lowest level, there are stylistic cues that can be taken from raw-mode regex
(regular expression,) analysis of the spelling and punctuation of a human user's input,
that can add a good deal of apparent intelligence to a bot, by reducing the reliance
on xnones, even when none of the content matches a higher-ranked keyphrase. These I
would term orthographic.
Examples would include the identification of a question or exclamation from the
terminal punctuator, apparent hesitation when the user ends with dot dot dot
or begins with a variant of hmmm, the presence of a numeric value in the
input, Leeds-style L33t 5p33k, or aaarrggh!-type utterances. Because
they are handled in "raw" mode, these don't rely on the content of the user input
at all, to the extent that they would work equally well in dealing with foreign
language input - it does not matter if the vocabulary used is entirely absent from
the WordNet dictionary, or if the LinkGrammar script can make no grammatical sense
of it at all.
Care needs to be taken to tailor the responses to any eventuality, to avoid
inappropriate responses, but it is a step up from the subject-changing question or
random interjection that is usually the best that can be achieved with an xnone.
I know a lot of people avoid regexes, thinking them to be difficult or unpredictable,
and this is not helped by the scant coverage that is afforded them in the Book of
AI. But they are worth learning about, enough to use some basic forms at least,
and there are plenty of resources on the Net to get you started; eg:
|
http://www.regular-expressions.info/tutorial.html http://www.zvon.org/other/PerlTutorial/Output/index.html http://weblogtoolscollection.com/regex/regex.php http://www.silverstones.com/thebat/Regex.html |
|
keyphrase [rank,emotion] {?PF AI Script ?} - just insert the relevant data into the appropriate boxes. If you're pasting them into an export file, please change the {curly brackets} into the requisite pointy ones (pointy ones won't show up on the web page.) |
ORTHOGRAPHIC - spelling & punctuation
([?]+)$ (re) [-1,0] {?PF raw ?} matches any number of question marks at the end of the user input.
[ !]$ (re) [-1,0] {?PF raw ?} matches a single exclamation mark at the end of the user input.
([ . .])([ .]+)$ (re) [-1,0] {?PF raw ?} matches 3 or more dots at the end of the user input.
([bcdfghjklmnpqrstvwxz0123456789]+) (re) [0,0] {?PF raw ?} matches any word with no vowels ("l33t 5p33k" etc.).
^([abcdefghijklmnopqrstuvwxyz]+)[ ?]$ (re) [3,0] {?PF raw ?} matches any single-word query.
([1234567890]+) (re) [3,0] {?PF raw ?} matches any integer, anywhere in the user input.
([a]+)([rgh]+)([ !]+) (re) [3,0] {?PF raw ?} matches all combinations of "r", "g", & "h", following any number of "a"s = "Aaarrgh!", and all its variants.
^([hmn]+) (re) [3,0] {?PF raw ?} matches all combinations of "h", "m" & "n" = "hmmm", and all its variants.
It is important to arrange the rankings carefully in cases where contact may overlap,
for example ([hmn]+) and ([1234567890]+) need to outrank
([bcdfghjklmnpqrstvwxz0123456789]+) in the above examples, or they will
be overridden.
Some examples:
SYNTACTIC - grammar & syntax
(adjartnoun) [0,0]
(verbadv) (adjartnoun) [2,0]
(adjartnoun) (verbadv) [2,0]
(adjartnoun) (verbadv) (adjartnoun) [4,0]
(adjartnoun) (verb) (verb) [5,0]
(prep) (artpos) (adjnoun) [5,0]
(adj)$ (re) [5,0]
The responses are a little more contextually focused than the orthographic layer,
and allow access to the various parts of speech, either via keys or the extended PF2
features (vmod, ssub, obj, etc.)
Some examples:
LINGUISTIC - vocabulary & idiom
your (adjnoun)$ (re) [10,0]
I (like|love) (adjnoun) [10,0]
I (*) (like|love) (adjnoun) [10,0]
^can you (verb) (re) [10,0]
you * (verb) * music, music * you * (verb) [15,0]
something * going on [15,0]
you sound (too much|a lot|) like [15,0]
so far so (adj)$ (re) [20,0]
how (adj) are you$ (re) [20,0]
how can I (verb) a (program|bot) (like you|of my own) [25,0]
Some examples:
FACTUAL - general knowledge
you (verb) * Nine Inch Nails [30,0]
you (verb) * They Might Be Giants [30,0]
...
you (verb) * Dickens [30,0] {?PF raw ?}
you (verb) * Shakespeare [30,0] {?PF raw ?}
...
(where|about) * New York [30,0]
(where|about) * Paris [30,0]
...
capital (city|) of Greece [30,0]
capital (city|) of Turkey [30,0]
...
(who|you) (verb) * (1984|Nineteen Eight Four|Aspidistra Flying|Wigan Pier|Down and Out in Paris) [30,0] {?PF raw ?}
(who|you) (verb) (Nostromo|Heart of Darkness|Secret Sharer|Tremolino|Nature of Crime|Black Mate|Arrow of Gold|Shadow Line) [30,0] {?PF raw ?}
...
Kentucky [30,0] {?PF raw ?}
Georgia [30,0] {?PF raw ?}
Just an old sweet song keeps Georgia on my mind.Milwaukee [30,0] {?PF raw ?}