English 中文(简体)
Simple Natural Language Parser in Objective-C
原标题:

I m building this app for Mac OS X v10.6

I m building a text-based adventure and I ve created a very simple natural language parser that can process the commands that the user types. So far it works great and can parse sentences such as: "take the sword" or "look in the box"

What I m trying to do is create a list of aliases for different words to make typing commands less strict. So for example "take" could have an alias of "grab" or "go" could have the aliases "move, walk, or travel"

I ve tried creating an NSDictionary where the key was the word and the value was an NSArray of aliases. The problem was that when determining if the command entered matched an available command, I would have to reference the aliases with the word that was used for the key.

I want to be able to use any of the aliases to reference any of the other aliases. Does anyone know of a good way to do that?

Another thought I had (but it seems to inefficient) is to store each set of aliases in an array. When parsing I would find the array that contains the word I want to match and try to match all the other words in that array against it.

最佳回答

Conceptually, I think you might find it productive to treat all words on the same footing. Let your dictionary have any word from your vocab as a key, and the value numerically encode the interpretation or information that guides interpretation in context.

问题回答

Check NSLinguisticTagger class (new in iOS 5)





相关问题
Java Stanford NLP: Part of Speech labels?

The Stanford NLP, demo d here, gives an output like this: Colorless/JJ green/JJ ideas/NNS sleep/VBP furiously/RB ./. What do the Part of Speech tags mean? I am unable to find an official list. Is it ...

Java Stanford NLP: Find word frequency?

I m using the Stanford NLP Parsing toolkit. Given a word in the lexicon, how can I find its frequency*? Or, given a frequency rank, how can I determine the corresponding word? *in the entire language,...

c/c++ NLP library [closed]

I am looking for an open source Natural Language Processing library for c/c++ and especially i am interested in Part of speech tagging.

Clustering text in Python [closed]

I need to cluster some text documents and have been researching various options. It looks like LingPipe can cluster plain text without prior conversion (to vector space etc), but it s the only tool I ...

Natural language rendering

Do you know any frameworks that implement natural language rendering concept ? I ve found several NLP oriented frameworks like Anthelope or Open NLP but they have only parsers but not renderers or ...

热门标签