So I have been working pretty steadily on the command phraser and discovered that it is an exponential problem. I get that "natural language processing" is a gigantic topic, so I shouldn't be surprised.. but I hoped to be able to fudge it to some degree using keywords. The core idea was that by having the app have a very limited word count that it would understand, it would effectively make the command processor keyword based, rather than actually language processing. Allowing me to discard large chunks of the input, distilling it down to very basic commands. So "Walk through the archway to the next room" would turn into "walk, north". The hope was that the player would "infer" that the app had a deeper understanding of what they were typing.
Now, for the most part, it is working, yet there are some difficult issues that I have yet to resolve. These mainly revolve around words that have different meanings depending on how you use them. So "exit" can mean "leave the room via the exit" and it can also mean "the doorway is an exit".
This is the current state of the project. (Download to Try it out)
- I have filled in the test level with junk areas.
- Each area has 2 items in it. A ball and a box.
- The very first area (the one you start in) has a load of text, so I can see a real example of how the prints function. Say when looking at something.
- The actual start room exit descriptions say they can not be used (as the game start room is not able to be left until you solve a puzzle) but for testing, you can just move from that start area.
- Only look and move actions have been implemented.
- Compound commands are yet to be done.. so "look" works "look ball" works but "look ball and look box" does not work.
Now this is all still a bit rough... but it looks like my original idea of how to actually process the keywords is not going to cut it.. it needs a ton of special case intervention to get it all working at the level I hope to run it. Still, it is working... you can walk about, look at things. I think that when I add more words to the lists, so there are more keywords, it will function close to how I wanted, but the act of adding more words increases the special conditions.
What I need to do is strip the command phrase back and run it through some code that can quantify what the structure of the phrase is. I am pretty sure that I can use simple English language rules for this. If I can identify what the parts of the phrase being entered are, then I can use that to direct the program to the correct command even when there is more than one meaning for a given keyword. As the structure of the sentence should inform me which key that keyword is supposed to be.
The querstion I have now is should I fix this.. or just keep going on as I have been. The demo project is small enough that I can get it functioning with the code I have, and then I could move to another moreexciting project.. or I could get this working perfectly and then move on. This text adventurer is a learnign thing.. so it might be time to start thinking of wrapping it up and moving to the next task?
Thanks for Reading!