python - can anyone help me with my spell check code -
i trying check spelling in text against dictionary shown in below codes:
# load dictonary dict_text = open('ku_tr.dic','r').read().split() # convert dictionary lowercase set() easy access dictionary = set( [i.lower() in dict_text] ) # load text words_to_check = codecs.open('test_test.txt', 'r', encoding='utf-8').read().split() # , check word in words_to_check : if word.lower() not in dictionary : print 'misspelled:', word the problem same words split in text file without comparing dictionary. appreciated.
this text needs spelled
'nasîne weqara pêgiri hemû endamêm malbata mirove û mafên wan ên wekhev û (jênager) bingehe azadî, dad û aşitiya cihanê pêk tîne.' the output should this:
'misspelled: nasîne' should written( nasîna ) example. 'misspelled: endamêm' 'misspelled: mirove' this dictionary example saved in (ku_tr.dic) file.
nasîna abor aborandin aborî/m aborîn aborînas/mn aborînasî/m aborîzan/mn aborîzanî/m aciz acûr acûra acûrî adan adar/m ade adekirin/m adet adetî
Comments
Post a Comment