tokestermw / spacy_hunspell

:pencil2: Hunspell extension for spaCy 2.0.
MIT License
94 stars 14 forks source link

Language Support (rather than English)? #6

Open Anwarvic opened 4 years ago

Anwarvic commented 4 years ago

As I can see, spacy_hunspell supports English perfectly... what about other languages like Arabic, French, ... etc.?

ju-resplande commented 4 years ago

@Anwarvic, the module seems to support other languages too...

InspaCyHunSpell(nlp, ('en_US.dic', 'en_US.aff')) andspacy.load('en_core_web_sm') change to your language dictionary and Spacy language model.

I did it for Portuguese.

from spacy.lang.pt import Portuguese
from spacy_hunspell import spaCyHunSpell

nlp = Portuguese()
hunspell_dicts = ('/usr/share/hunspell/pt_BR.dic', '/usr/share/hunspell/pt_BR.aff')
hunspell = spaCyHunSpell(nlp, hunspell_dicts)
nlp.add_pipe(hunspell)

where I've installed hunspell-pt-br and Portuguese spacy models