Skip to content

Commit

Permalink
throw an error vocab make unigram_table error
Browse files Browse the repository at this point in the history
  • Loading branch information
tomolopolis committed Oct 14, 2020
1 parent 2e18d04 commit a6745a7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion webapp/api/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,15 @@ def submit_document(request):
CAT_MAP=CAT_MAP, project=project)

if project.train_model_on_submit:
train_medcat(cat, project, document)
try:
train_medcat(cat, project, document)
except Exception as e:
if project.vocab.id:
if len(VOCAB_MAP[project.vocab.id].unigram_table) == 0:
raise Exception('Vocab is missing the unigram table. On the vocab instance '
'use vocab.make_unigram_table() to build')
else:
raise e

# Add cuis to filter if they did not exist
cuis = []
Expand Down

0 comments on commit a6745a7

Please sign in to comment.