I have a file with a few lines of English sentences. Some of these words are misspelled and I am looking to construct a function that:
for example input: x = "This is the lnguage of Pithon " Result: = Wrong words: ['lnguage','pithon']
You can use the GingerIt API with python library like this
IN TERMINAL
pip install gingerit
FOR CODE
from gingerit.gingerit import GingerIt
text = input("Enter text to be corrected")
result = GingerIt().parse(text)
corrections = result['corrections']
correctText = result['result']
print("Correct Text:",correctText)
print()
print("CORRECTIONS")
for d in corrections:
print("________________")
print("Previous:",d['text'])
print("Correction:",d['correct'])
print("Definiton:",d['definition'])
Test it here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.