Skip to content
Snippets Groups Projects
Commit e985c022 authored by vvye's avatar vvye
Browse files

Fix issue

parent 7f168ea7
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,10 @@ def main(args):
timeline = timeline_generation.make_timeline(articles, gold_timeline, keywords, by_tokens)
if not timeline:
print(' the generated timeline is empty - skipping evaluation of this one')
continue
if args.print_timelines:
timeline_generation.print_timeline(timeline)
......
......@@ -47,6 +47,7 @@ def summarize(sentences, vectorizer, keywords, by_tokens, num_sentences, num_tok
# go through all sentences in order from "best" (most similar to centroid) to "worst"
for i in sorted_indices:
# don't consider this sentence in the next round
remaining_indices.remove(i)
# if the sentence contains no keywords, skip it
......@@ -60,7 +61,7 @@ def summarize(sentences, vectorizer, keywords, by_tokens, num_sentences, num_tok
if sum([len(sentences[k]['text'].split()) for k in (selected_indices + [i])]) > round(num_tokens):
continue
else:
if len(selected_indices) + 2 > round(num_sentences):
if len(selected_indices) + 1 > round(num_sentences):
continue
# otherwise, select the sentence
selected_indices.append(i)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment