Re: Verb-Noun Parser
Posted: Wed Nov 13, 2013 2:33 pm
Interesting idea. There are many ways of doing this, of course. Here is one simplified way (for example, it assumes that objects names and action names do not collide). First tokenize the user string to find objects (by name), then find actions (functions) for this objects. I have just pushed an example here (and in the attachment).Echo wrote:I want to make a verb-noun parser for my visual novel game engine. A verb-noun parser is used to recognize input made as strings by the player. For example you could type in "open door", then the computer will use the verb-noun parser to recognize the word open as a verb, you are telling the computer that you want to open something but what? then it looks for a noun to attach this verb to, door is a noun, it is an object, then using the computers programmed logic it will link the two, open + door, it then recognizes this as a valid action and performs the task.
I know how this works in my mind but I have no idea how to code this from scratch in Lua, I have a hint that it involves something to do with converting variables into strings and vice versa, could be wrong though.