Incompatible architecture on macOS
ZohairAbbas opened this issue · comments
Here is my code:
import json
from symspellpy import SymSpell, Verbosity
sym_spell = SymSpell(max_dictionary_edit_distance=2, prefix_length=7)
dictionary_path = "frequency_dictionary_en_82_765.txt"
sym_spell.load_dictionary(dictionary_path, term_index=0, count_index=1)
with open('jd.txt', 'r') as file:
text = file.read()
lines = text.splitlines()
spelling_error_instances = []
for line_number, line in enumerate(lines, start=1):
words = line.split()
corrected_line = []
has_spelling_error = False
for word in words:
suggestions = sym_spell.lookup(word, Verbosity.CLOSEST, max_edit_distance=2)
if len(suggestions) > 0:
corrected_word = suggestions[0].term
if corrected_word != word:
corrected_line.append(corrected_word)
has_spelling_error = True
else:
corrected_line.append(word)
else:
corrected_line.append(word)
corrected_line = ' '.join(corrected_line)
if has_spelling_error:
spelling_error = {
"lineNo": line_number,
"problemPhrase": line.strip(),
"solutionAdvice": corrected_line.strip(),
"stepTaken": "Replace word"
}
spelling_error_instances.append(spelling_error)
response = {
"status": "spelling_errors_detected",
"spellingErrorInstances": spelling_error_instances
}
print(response)
I don't know why but I'm having this issue while running this code in macOS:
ImportError: dlopen(/Users/hermainqadir/anaconda3/envs/spellchecker/lib/python3.11/site-packages/editdistpy/damerau_osa.cpython-311-darwin.so, 0x0002): tried: '/Users/hermainqadir/anaconda3/envs/spellchecker/lib/python3.11/site-packages/editdistpy/damerau_osa.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/hermainqadir/anaconda3/envs/spellchecker/lib/python3.11/site-packages/editdistpy/damerau_osa.cpython-311-darwin.so' (no such file), '/Users/hermainqadir/anaconda3/envs/spellchecker/lib/python3.11/site-packages/editdistpy/damerau_osa.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))