Skip to content

Commit

Permalink
#4 add exception handler for termextract
Browse files Browse the repository at this point in the history
  • Loading branch information
Dacihi Fukui committed Jul 13, 2019
1 parent 2548bcc commit 78dc869
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,17 @@
term_imp = termextract.core.term_importance(frequency, LR)

data_collection = collections.Counter(term_imp)
noun, value = data_collection.most_common()[0]
try:
noun, value = data_collection.most_common()[0]
except IndexError:
print ("extractor: INFO: No keyword found. Create empty keyword file...")
file = open('data/keyword','w')
file.write('')
file.close()
end = time.time()
time.sleep(15-(end-start))
continue

noun_p = termextract.core.modify_agglutinative_lang(noun)

# OPT1: show the most common word
Expand Down

0 comments on commit 78dc869

Please sign in to comment.