Skip to content

Commit

Permalink
bugfix for new_word_finder
Browse files Browse the repository at this point in the history
  • Loading branch information
yangyaofei committed Jul 5, 2021
1 parent 6ecc082 commit a66901a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion nlpir/new_word_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,15 @@ def find_new_words(text: str, max_key: int) -> typing.Optional[typing.List[dict]
...
]
"""
return json.loads(__instance__.get_new_words(line=text, max_key_limit=max_key, format_opt=native.OUTPUT_FORMAT_JSON))
result = __instance__.get_new_words(line=text, max_key_limit=max_key, format_opt=native.OUTPUT_FORMAT_JSON)
try:
result = json.loads(result)
if result is not None:
return result
else:
return []
except json.decoder.JSONDecodeError:
return []


@__get_instance__
Expand Down

0 comments on commit a66901a

Please sign in to comment.