Page 1 of 1

Sentence parsing

Posted: Tue Dec 28, 2004 8:28 am
by Xombie
Not sure if this should be here or 'Off Topic' but i'll give it a shot here.

No, I'm not looking for a way to get each word in a sentence. I'm looking more for a way to ... hmmm... diagram a sentence. I guess - would this fall under Natural Language Processing?

I'll take anything anyone wants to pass my way. Code already worked on, web resources, whatever ^_^

I'd like to work on a simple bot that can take apart a sentence and react according to that or store information based on what the user types. The other parts I have an idea of where to begin - not so much here.

Re: Sentence parsing

Posted: Tue Dec 28, 2004 10:40 am
by PB
> Not sure if this should be here or 'Off Topic' but i'll give it a shot here

Your topic belongs here in General Discussion, which, as the name suggests,
is for general coding discussion. The Off-Topic section is for anything not
directly related to coding and/or PureBasic.

As for your question -- I can't help. :lol:

Posted: Tue Dec 28, 2004 2:54 pm
by MadMax
For thesesort of things PERL is very powerfull

Posted: Fri Dec 31, 2004 11:53 am
by The_CodeMaster
I'm looking more for a way to ... hmmm... diagram a sentence
Use a database or a spreadsheet. Sounds to me like some AI-program, anyway, you might want to have a look at this:

viewtopic.php?t=7261&highlight=

Posted: Sun Jan 02, 2005 1:15 pm
by GedB
CodeMaster,

The simplest way to diagram a sentance is as a sort of State Chart. This is how recursive descent parser works.

Take a look at this gif of a Pascal syntax, you can follow the lines like a flowchart: http://www.cs.uaf.edu/~cs331/notes/Pascal1.gif

For a simple sentance you can model it like this:

Code: Select all


Paragraph =   Sentance ---> Carriage Return ---> End
                       ^         |
	                   | ----------|

Sentance =    Word ---> Full Stop ---> End
                     ^     |
                     |  Space
	             |----|

Word =          Letter ---> End
                      ^      |
	              |-----|

Letter =             [A-Z]|[a-z]
Space  =            Chr(32)
Carriage Return = Chr(13) + chr(10) (for windows)


Re: Sentence parsing

Posted: Sun Jan 02, 2005 2:05 pm
by Dare2
Hi Xombie,

There was a program called Eliza (done in basic for dos) which did something along those lines (if I understand your description). Basically got the guts of a sentence and responded with something that seemed meaningful. The general concept has been taken and extended from time to time.

http://www.google.com.au/search?hl=en&q ... arch&meta=

The above brought up a few results. Some may be useful?