Analysis of text commands?

I am interested in writing a parsing engine, for example, in Inform, which is very reliable.

I tried a couple of different approaches:

  • regular expression. For regex, I can only match. {verb} {noun1 optional-noun2} {optional-preposition} {indirect-noun1 optional-indirect-noun2}It doesn't work so well.
  • a list of predefined verbs and their associated preposition and nouns. This approach is too complicated, as there must be a lot of predefined data.
  • breaking into different words and launching them through dictionary cards. Again, this is too complicated and impractical due to the ambiguity of certain words, such as “watch” or “set (on, off)”

I know about language processing, although in fact I have no idea how to start, and some of them are too complicated. (There is no CS background, I'm just learning on my own now).

Some ideas that I have:

  • As I said, natural language processing.
  • Create a parser that parses something similar to SQL.

Are there any other ideas? How will I develop and implement them?

Note. I use Python as my language. and in case you missed it, I don’t develop a programming language, I just parse a user command, such as "go north" or complex material, such as "pull out the fire with a blanket"

+3
source share
1 answer

pyparsing, ( ), nltk. , book.

+2

All Articles