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()
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()