2

I have trialled a number of options for a quick spelling replacer, namely autocorrect, spellchecker and textblob. However, I have some words that are being altered as they are not in the dictionary, for example Zumba. I have tried adding to the dictionaries in the packages, but I continue to get the same results.

FOr example for autocorrect I located the dictionaries in \autocorrect-master\words.bz2...I added in the words to all the files in here. Reloaded the package and no change!

Im new to editing packages so figure either im doing something wrong, or its no possible!

For most instances all packages work great, but I need to be able to account for some specific words not in the dictionaries.

Thanks in advance

Siobhan
  • 163
  • 11
  • it would be helpful if you could share the code (maybe the package in this case) that you are working on, what your input to the code is, the code you are working on, the output you are getting vs the expected output. This way people can better help you solve your problem. – d_kennetz Aug 24 '18 at 14:45
  • Apologies, I had issues copying from server to this window! However, I have managed to resolve the issue! for textblog package its simplay a matter of ; `code` import textblob as tb tb.en.spelling.update({'zumba':1}) Now I get zumba through ok rather than it being replaced with "dumba" whatever a dumba is!! – Siobhan Aug 24 '18 at 14:51

2 Answers2

1

So, the solution I have found is as follows (for autocorrect package);

import autocorrect as 
ac.word.LOWERCASE.update({'zumba'})
ac.word.MIXED_CASE.update({'Zumba'})

I got to this simply by iterating through the module attributes;

dir(ac.word.LOWERCASE)

Sorted!

Siobhan
  • 163
  • 11
1

The above solution does not work anymore in the current version of autocorrect. The dictionary is now found in the speller class

import autocorrect as ac
spell = ac.Speller()
spell.nlp_data.update({"Zumba":1000})

Not sure what the number number stands for but this worked for me.

Chris C
  • 11
  • 1