adamfabish / Reduction

Reduction is a python script which automatically summarizes a text by extracting the sentences which are deemed to be most important.
54 stars 19 forks source link

Error in reduction.py using your example #5

Open lukakostic opened 6 years ago

lukakostic commented 6 years ago
from reduction import *
reduction = Reduction()
text = "NLTK is a python library for working human-written text. Summarize is a package 
that uses NLTK to create summaries."
reduction_ratio = 0.5
reduced_text = reduction.reduce(text, reduction_ratio)

results in error:

Traceback (most recent call last): File "Sum.py", line 5, in module reduced_text = reduction.reduce(text, reduction_ratio) File "reduction.py", line 194, in reduce rankedSentences = self.sentenceRank(paragraphs) File "reduction.py", line 182, in sentenceRank g = self.buildGraph(sentences) File "reduction.py", line 169, in buildGraph w = self.findWeight(i.Sentence, j.Sentence) File "reduction.py", line 140, in findWeight length1 = len(filter(lambda w: w.Type == WordType.Content, sentence1.Words)) TypeError: object of type 'filter' has no len()