Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple dictionaries? #37

Open
JuanCaicedo opened this issue Apr 5, 2016 · 6 comments
Open

Multiple dictionaries? #37

JuanCaicedo opened this issue Apr 5, 2016 · 6 comments

Comments

@JuanCaicedo
Copy link

I see in the docs that Typo needs to be initialized with a dictionary code. Would it be feasible to enhance this so that it can load multiple dictionaries? If that's not impossible and sounds useful, I would be willing to help :)

@cfinke
Copy link
Owner

cfinke commented Apr 8, 2016

It's not impossible. Is the use case for bi-lingual people that would be writing in multiple languages? Or is it for loading multiple dictionaries in a single language, like the main English dictionary plus a slang dictionary?

It might be simpler to just instantiate multiple Typo objects, one for each dictionary.

@JuanCaicedo
Copy link
Author

Personally I have a Spanish and English dictionary, but I think this would serve both use cases.

Currently I have a prototype where I instantiated two Typo object, though what I have to do is do a lookup in both and then concat the results. It would be nice if I could make one call and get a single array of suggestions from both dictionaries. Also, that step could remove duplicates.

@akonsu
Copy link

akonsu commented Sep 21, 2016

This feature is what I was looking for too. My use case is a language dictionary and a dictionary with technical terms for this language.

@richardtallent
Copy link

I ended up manually adding words to dictionaryTable from a Javascript array. That did the trick for my limited needs, which simply involve handling some industry-specific lingo.

@zguillen
Copy link

zguillen commented Mar 9, 2017

@richardtallent I need to do something similar (letting users add a term to the dictionary while editing a file) and I tried the same approach you did, something like:
typo.dictionaryTable[word] = null;

but I put a breakpoint in typo.js's 'checkExact' function that runs right after I add the new word and its not there. Did this work for you?

@zguillen
Copy link

zguillen commented Mar 9, 2017

oh, nevermind...I just happened to be testing with a word that although was correctly being added to dictionaryTable it would fail the spell checking for other reasons (the word was zoe1234zoe or something, and the combo of letters and numbers is what failed the check, not the word).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants