The Homepage of NLQ.py
|[2001-04-15] The current NLQ version is 0.1 - Beware!|
NLQ.py is a quick and dirty (with an emphasis on both) python module that attempts to parse an incoming "Natural Language" query, like "How many keywords does Python have?" and "Why do I get this rash when I pet my cat?" I needed something like this for a project that I was working on and this is what I came up with in the course of an evening.
NLQ.py is implemented as a Python class (class NLQ). For every NLQ you have, you declare an NLQ object and give it the string. The object takes the string, chops it up and attempts classify it and extract the relevant pieces. This is all gone over more in the class definition.
NLQ.py is pre-pre-pre-alpha. I have no AI experience. I have no relevant language experience. The design of this may change at any time. The woman that you think is your mother is really a being from another planet placed there to raise you until you're old enough to have your True Purpose revealed to you. Pro wrestling is real.
DefinitionThe NLQ.py module
...contains a handful of definitions.
...and one function - determine_type. D_t is used by the NLQ objects to assess the string and fit it into one of the pigeon-hole types defined above. Absurdly simplistic right now...
abg@stegosaurus ~/src/nlq $ ./nlq.py "Who is the greatest baseball player?" type: 1 keywords: ['greatest', 'baseball', 'player'] abg@stegosaurus ~/src/nlq $ ./nlq.py "Why should I file my taxes?" type: 3 keywords: ['should', 'file', 'taxes'] abg@stegosaurus ~/src/nlq $ ./nlq.py "Should I dye my hair pink?" type: 0 keywords: ['dye', 'hair', 'pink']