And here is a simple and straight forward implementation of the idea
presented in the above statements. Try it. Works pretty well.
def summarize(bag_of_words, listOfSentences):
output_sentences = []
word_frequencies = FreqDist(bag_of_words)
most_frequent_words = [pair[0] for pair in word_frequencies.items()]
for word in most_frequent_words:
for i in range(0, len(listOfSentences)):
if (word in listOfSentences[i] not in output_sentences):
output_sentences.append(listOfSentences[i])
break
return output_sentences
Pravin
--
FOSS Nepal mailing list: [email protected]
http://groups.google.com/group/foss-nepal
To unsubscribe, e-mail: [email protected]
Mailing List Guidelines:
http://wiki.fossnepal.org/index.php?title=Mailing_List_Guidelines
Community website: http://www.fossnepal.org/