python - Using values from a list to do spell checking -


after passing spelling checker text, list containing position of word spelled, length of original word , word suggested spelling checker. this:

['54,5,button', '80,2,too', '108,15,automatically', '264,6,went back', '318,7,perform', '333,4,said', '428,6,gone'] 

what have use data in list orthographic correction in original text. given length of suggested word may different original word, think should divide text parts, make correction in parts containing words corrected , reconstruct text parts. have programmed not know how drag data need 1 iteration another.

p = 'the text....' spell = ['54,5,button', '80,2,too', '108,15,automatically', '264,6,went back', '318,7,perform', '333,4,said', '428,6,gone'] data = [] k,v in enumerate(spell):     if k == 0:         = v.split(',')         a1 = int(a[0]) - 1         b = p[:a1]         b1 = int(a[0]) + int(a[1])         c = p[int(a[0]):b1]         data.append(b)         data.append(c) 


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -