Skip to content

Not working with loaded dictionary? #1

@legoly

Description

@legoly
  • SymSpellCompound version: 0.1.0
  • Python version: 3.6
  • Operating System: MacOS Sierra

Description

I tried to load a dictionary from here:

https://github.com/wolfgarbe/SymSpellCompound/blob/master/SymSpellCompound/wordfrequency_en.txt

with this code:

    def load_dictionary(self, corpus, language, term_index, count_index):
        words = []
        for line in open(corpus, "r"):
            words.extend(word.lower() for word in line.split() if word[0].isalpha())

        counts = Counter(words)
        for word, count in counts.most_common():
            self.create_dictionary_entry(key=word, language=language, count=count)

        return True

What I Did

I tried some of the examples from here:
https://github.com/wolfgarbe/SymSpellCompound

print(ssc.lookup_compound(input_string="in te dhird qarter oflast jear he hadlearned ofca sekretplan y iran", language="en", edit_distance_max=3))

Output:
ines:1:194.27231115

print(ssc.lookup_compound(input_string="whereis th elove hehad dated forImuch of thepast who couqdn'tread in sixthgrade and ins pired him", language="en", edit_distance_max=3))

Output:
Traceback (most recent call last):
File "symspellcompound.py", line 410, in
print(ssc.lookup_compound(input_string="whereis th elove hehad dated forImuch of thepast who couqdn'tread in sixthgrade and ins pired him", language="en", edit_distance_max=3))
File "symspellcompound.py", line 325, in lookup_compound
suggestion_split.term = suggestions1[0].term + " " + suggestions2[0].term
IndexError: list index out of range

Any help would be appreciated. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions