Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello guys good evening:
i want to make a simple parsing, but i have no idea to start.
first i get the text and split it to a words of array, then what can i do.

for example i have the following phrase :

"Open the CD_Drive"

the result will be:
Open --> Verb.
the --> det.
CD_Drive --> Noun.


thanks for help.
Posted
Updated 6-Feb-13 7:05am
v2
Comments
Jameel VM 6-Feb-13 12:58pm    
what you want actually?please improve your question by adding your requirement
alcitect 6-Feb-13 13:00pm    
thanks for replay a will improve it.
Sergey Alexandrovich Kryukov 6-Feb-13 13:10pm    
I think the problem is just the opposite: what you need is basically clear, but the problem is big, hardly answerable in one quick question. I think the real parsing of real natural languages is the hopeless task, you need to simplify things highly. In other words, device some very simple language only resembling a natural one. Pretty much like a programming language. And learn some theory and practice of parsers, but not pick up an extremely universal and complex way. You need to start with the formulation of the language, most probably, with EBNF.
—SA
alcitect 6-Feb-13 13:20pm    
thanks Sergey for replay
Sergey Alexandrovich Kryukov 6-Feb-13 13:32pm    
Will you accept my answer formally (green button)? This is basically a way to go, but it's hard to give a more detail advice, as the topic is big.
It won't prevent you from getting other advice; maybe someone knows a project which is closer to what you want, but only you can make a decision.
—SA

Once you've worked your way through EBNF and LALR1 parsers and parser generators like Flex and Bison you might want to look at chart parsers for NLP like Alvin, they are or were thought by some to have greater potential than other approaches. My info is a little old now though so you'll have to trust your own research. You could also look into Boost::spirit if you want some seriously C++ parsing technology. This is mind bending stuff but also a lot of fun.
 
Share this answer
 
Comments
alcitect 6-Feb-13 14:07pm    
thanks Mathew
Sergey Alexandrovich Kryukov 6-Feb-13 14:10pm    
It's a good idea to look at all this stuff, but as it's all C++, it will make it way more difficult. It's possible to find .NET stuff. Main thing is formulation of reasonably simple language. (I voted 4.)
—SA
Matthew Faithfull 6-Feb-13 14:13pm    
Fair enough, you spotted my attempt to recruit this one for the dark side :<{
Sergey Alexandrovich Kryukov 6-Feb-13 17:15pm    
:-)
Please see my comments to the question. You should start with formulation of the language you want to parse. If cannot be a "real" natural language, and should not be. Just the opposite: think about making it only slightly resembling a "real" natural language, but try to make it as simple and strict as possible, unless you problem will be hopeless.

Some references:
http://en.wikipedia.org/wiki/Backus%E2%80%93Naur_Form[^],
http://en.wikipedia.org/wiki/EBNF[^],
http://en.wikipedia.org/wiki/Parser[^].

Some ideas:
https://npmjs.org/package/ebnf-parser[^],
http://www.nongnu.org/bnf/[^],
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/87a9c718-d549-48f6-a81d-795a349d4ce7[^].

This is a .NET project: http://ebnfnet.sourceforge.net/[^].

Again, the topic is too big to give a definitive advice. More importantly, it all depends on how big is the scope of your application and complexity of your language. Maybe, you need something simpler, but made all by yourself.

Please consider my advice mostly as the directions on how to learn what's involved and for getting some basic ideas.

—SA
 
Share this answer
 
v2
Comments
alcitect 6-Feb-13 14:08pm    
Ok let we c
alcitect 8-Feb-13 9:16am    
ok now i was read many thing as your advice, and found there is to layers of parsing:
1: lexical Parsing
2: semantic parsing.
what i search about is the lexical parsing only.
Sergey Alexandrovich Kryukov 8-Feb-13 12:29pm    
Yes, you see, I still say your should use as simple language as possible. Extreme simplicity of basic English would help you. I would advise that you reduce semantic parsing to as simple as possible, so it would be trivial, almost non-existing. For example: fixed position or order of verb, object, etc., fixed set of verbs or other members, and so on.
—SA
alcitect 8-Feb-13 12:43pm    
thanks sergey for help. pls can you replay this. cause my English not so good.
Sergey Alexandrovich Kryukov 8-Feb-13 12:55pm    
English? I understand your English well enough, but please just do some minimal effort to make it more readable: 1) capitalize properly, 2) use full punctuation, 3) don't use abbreviations; this is just a matter of politeness and is usually required by members. Other that, you English is almost fine; I can see only minor grammar problems; and spelling is mostly fine (if you use spell check, it's a great idea; many Web browsers have spell check embedded, works as you type...).

So, what are you asking about now?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900