Skip to content

Commit

Permalink
Merge pull request #3 from gurunath-p/patch-1
Browse files Browse the repository at this point in the history
Fix out of index error in candidate_generator
  • Loading branch information
sai-prasanna authored Jan 27, 2020
2 parents 97b6045 + dcd1555 commit 1086f52
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lmproof/candidate_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def load(cls, language: str) -> "SpellCorrectGenerator":
/ "resources"
/ "frequency_dictionary_en_82_765.txt"
)
symspell.load_dictionary(str(dict_path), term_index=0, count_index=1)
sym_spell.load_dictionary(str(dict_path), term_index=0, count_index=1)
spacy_model = spacy.load("en_core_web_sm", disable=["parser", "ner"])
else:
raise RuntimeError(f"The language {language} is currently not language.")
Expand Down Expand Up @@ -127,7 +127,7 @@ def _edits(
elif replaced_token.is_upper:
substitute = substitute.upper()

if token_idx == 0 and substitute == "" and len(tokenized_sentence) >= 1:
if token_idx == 0 and substitute == "" and len(tokenized_sentence) > 1:
candidate = Edit(
Span(replaced_token.idx, tokenized_sentence[1].idx + 1),
tokenized_sentence[1].text[0].upper(),
Expand Down

0 comments on commit 1086f52

Please sign in to comment.