ok. i need some help in this.
How would i write the parser to do this? I'm looking at trees, yet i don't yet know how to code it.
From,
Nice coder
Computers and people
I can give you some code, to show you how to parse a sentence to get the grammar.
* What my code CAN'T do :
- Handling non fixed vocabulary. An example : in French, the verb "to eat" is "manger". Then your dog will eat a bone, the English says "will eat", but the French "mangeras", "as" is added to "manger". The same for "do", "did", "does", etc... Each Occidental language have non fixed vocabulary. Chinese or Vietnamese are languages smarter for this ;) Only one word for a lexical entity, that's all.
- Handling non LL(1) grammars. Google for the definition.
My code is a LL(1) parser to read an XML-like data file format. I can modify it for a "Tarzan-like english" parser next week (I had a full time job...), that move a cursor on the screen. Commented C is ok ?
Handling others kinds of grammar, like LALR(1), Bison is THE solution. It produces a full functionnal parser from a grammar definition.
* What my code CAN'T do :
- Handling non fixed vocabulary. An example : in French, the verb "to eat" is "manger". Then your dog will eat a bone, the English says "will eat", but the French "mangeras", "as" is added to "manger". The same for "do", "did", "does", etc... Each Occidental language have non fixed vocabulary. Chinese or Vietnamese are languages smarter for this ;) Only one word for a lexical entity, that's all.
- Handling non LL(1) grammars. Google for the definition.
My code is a LL(1) parser to read an XML-like data file format. I can modify it for a "Tarzan-like english" parser next week (I had a full time job...), that move a cursor on the screen. Commented C is ok ?
Handling others kinds of grammar, like LALR(1), Bison is THE solution. It produces a full functionnal parser from a grammar definition.
The point I think some posters misses here, is that Nice Coder tries to do a "star trek"-like computer. That is, a computer that understands a simple SPOKEN phrase. In that case, simplifying the language can increase recognition drastically.
"Understanding" a language not much more complicated than a bash script is a thing done for ages, but coupling it with a speech recognition device could prove interesting
"Understanding" a language not much more complicated than a bash script is a thing done for ages, but coupling it with a speech recognition device could prove interesting
Implementing a scripting engine - Not quite what you wanted, but he uses both lex and bison to make the scripting engine.
Quote:Original post by Yvanhoe
"Understanding" a language not much more complicated than a bash script is a thing done for ages, but coupling it with a speech recognition device could prove interesting
Not really... you can already issue simple commands using most speech recognition packages today. It's just another layer on top of the parsing, that's all.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement