Processing and understanding sentences
I am trying to write a simple code that can process words in a sentence to form meaning. I have been trying to develop a good algorithm for a long while now, and however I try to do it the al开发者_StackOverflow中文版gorithm is scaringly tending to be too complex and long. Please if you have some suggestions, I'd appreciate. Thanks
You are discussing the field of Natural Language Processing (NLP). It is a very complex issue, and an area of active research.
It is safe to say there will never be a simple way of parsing a general English sentence, let alone establishing meaning.
The School of Informatics at the Univeristy of Sussex has a set of NLP lectures online that may help you to understand some of the issues which make this such a hard problem.
Well, turned out the algorithm has to be complex and long since the brain is actually complex and deep. I have made advances with my code but it's nothing easy. My approach was to use an information database which is analyzed by inspecting every words in each sentence and their meanings + associations but no matter how hard I try, I figured out understanding can only be simulated. For instance:
My pocket is full of bugs.
Will be understood as:
Animal Bugs are in your pocket.
Implications:
- You are in trouble
- You are a bug collector
- You want to use bugs for something
Electronic Bugs are in your pocket
Implications
- Bugs are planted in your pocket
- You have some electronic bugs
The word database for bug (NOUN) being:
Bug (Animal)
- Definition: Insect.
- Properties: Width: 15mm; Height: 25mm; Color: Black, Red, Orange; Importance: Relative - Biology; Danger: 2; Desirability: 0;
- Function: Base
Bug (Device)
- Definition: Electronic device.
- Properties: Width: 45mm; Height: 45mm; Color: Any; Importance: Relative - Security; Danger: 2; Desirability: 1
- Function: Sound Recording
The two simulated meanings at least can be deduced from the above and the algorithm makes an intelligent guess to begin a series of questions in order to find out exactly what is meant.
精彩评论