QQ Xiaoqiang, the basic principle is to have a comparison table according to the Chinese grammar rules. For example, you said: "Let's die", you will find records related to "Death" in the comparison table in the program, and then compare the records related to "death", randomly identify one (If the conversation will not be repeated).
If the sentence is too long, for example, "I am very unhappy today", find out the "subject of the guest" in the sentence, this is divided into: "I", "no", "Happy", one-on-one combination and reply to the table Match, and then the record of the preliminary screening for "I don't have fun", and finally confirmed the recording of the reply.
If the phrase / vocabulary is relatively simple, you can confirm that you can confirm up to 2 layers of filtering.
In addition, in a sentence, confirm the subject is critical, so that you can decide the object of the reply, for example: "You", then, reply is, there will be "I", if the main is "me", then reply In, it is determined that the object is "you".
Second, it is logical judgment, "Yes", "No", "not", "may", "not", "affirmation", etc., to determine the meaning of nouns or verbs that come with later (ie corresponding verbs or nouns) Corresponding table).
Example analysis: "You go to die", extract keywords: "You" (main), "death" (verb)
Subject correspondence: The subject "You" association reply: I am the main "you" association reply: then you
Verbs "dead" association reply: Don't die "dead" association reply: want to die? Death "Related Reply: Why do you want to die a verb" dead "association reply: death is very terrible
After screening, it is output according to the subject of the host:
I don't want to die, then do you want to die? So why do you want to die, why do I want to die, I am terrible. . . . . . . . . The combination of combination.
Example 2:
Input statement: I am very unhappy today, extract keywords: "I", "no", "happy"
Subject correspondence: The subject "I" association reply: Your main "I" association reply: then I
Verbs and logic corresponding table: 1 verb "happy" logic: do not affiliated reply: Think about sad things 2 verbs "Happy" logic: Do not affiliated reply: Many people in the world have more misfortunes 3 verbs "Happy" logic: Do not related Reply: I feel sad 4 verbs "happy" logic: Yes Related Reply: Very happy 5 Verbs "Happy" Logic: Yes Related Reply: After Groid After the subject, logic, verb screening, according to the subject of the host, only input: 1-3 (The logical field is: not):
You think about sad things, many people in the world are even more unfortunately, you feel sad.
The above reply is too reluctant. If you want to make the sentence vivid, smooth, then you need to add more verbs, adjectives, nouns and other words analysis and corresponding reply to the corresponding table. In addition, if you want your robot to be more powerful, you must do "memory preference" function, which is the previous conversation, and the new dialogue is based on memory. This is complex.
This article is my reply http://community.9cbs.net/expert/topic/3353/3353319.xml?temp =.3312952 stickers. Throwing jade, hoping to discuss with you.