I'm looking to build a开发者_JS百科n algorithm that can join together sentence parts. So, for example, it would know that
"drank it down and ordered a second glass,"
would be able to follow:
"He listened to what she had to say and ordered a glass of wine,"
but
"by trying to know what he could not understand,"
would not.
I'm familiar with the NLTK - any suggestions?
This is actually proven to be unsolvable. The code would have to have understanding of the meaning of the words to be sure. What you are effectively asking for is a Context-free Grammar (http://en.wikipedia.org/wiki/Context-free_grammar) which simply doesn't exist for human languages.
精彩评论