A quick introduction to NLP...
Jul. 30th, 2010 01:48 amNLP stands for Natural Language Processing, by the way.
In the context of this exercise, I will be using Prolog, a logic-based programming language where you don't deliberately write what the computer is supposed to do directly, but give it the input, the general structure of the problem, and some requirements for the solution and the language does the rest.
(perhaps a better description is that it takes the general structure of a problem, then tries to prove queries about the problem)
( Major geekage cut )
Anyway, I said all that to help with this:
As easy as Prolog can be to parse written languages, how about writing a text-based adventure game with it?
TBAGs have the advantage of only needing to run the parser one way (forwards, on each command the user gives it) and usually have very simple command sets.
(it would be rather unwieldy to use the parser to generate all output the player sees, as it would cause your list of grammar rules to balloon to an enormous size and waste all sorts of space and time)
At present, I have a tiny demo actually running, and I can give it some typical commands (primarily move and look so far).
What I'll need to do next is figure out how to have objects' properties change what you can do in the room.
(ie, unlock doors, open boxes, take items, etc.)
Anyway, I've got less than a hundred lines of code (as there are quite a number of rules that span several lines) and it's an (almost) working prototype.
I'm still rather impressed...
In the context of this exercise, I will be using Prolog, a logic-based programming language where you don't deliberately write what the computer is supposed to do directly, but give it the input, the general structure of the problem, and some requirements for the solution and the language does the rest.
(perhaps a better description is that it takes the general structure of a problem, then tries to prove queries about the problem)
( Major geekage cut )
Anyway, I said all that to help with this:
As easy as Prolog can be to parse written languages, how about writing a text-based adventure game with it?
TBAGs have the advantage of only needing to run the parser one way (forwards, on each command the user gives it) and usually have very simple command sets.
(it would be rather unwieldy to use the parser to generate all output the player sees, as it would cause your list of grammar rules to balloon to an enormous size and waste all sorts of space and time)
At present, I have a tiny demo actually running, and I can give it some typical commands (primarily move and look so far).
What I'll need to do next is figure out how to have objects' properties change what you can do in the room.
(ie, unlock doors, open boxes, take items, etc.)
Anyway, I've got less than a hundred lines of code (as there are quite a number of rules that span several lines) and it's an (almost) working prototype.
I'm still rather impressed...