Skip to content

Commit

Permalink
include score in output
Browse files Browse the repository at this point in the history
  • Loading branch information
amydunphy authored Aug 29, 2023
1 parent 07a82aa commit 775e7fc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/model/fasttext.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ def respond(self, docs: Union[List[schemas.Message], schemas.Message]) -> List[s
#and will remove the script tag unless the language is often written in different scripts
#setting macro=True allows us to standardize ISO macro languages (eg. swa == swh -> sw)
model_language = standardize_tag(model_output[0][0][9:], macro = True)
model_script = None
if '-' in model_language:
[model_language, model_script] = model_language.split('-')

detected_langs.append(model_language)
detected_langs.append({'language': model_language, 'script': model_script, 'score': model_certainty})

for doc, detected_lang in zip(docs, detected_langs):
doc.response = detected_lang
Expand Down

0 comments on commit 775e7fc

Please sign in to comment.