Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Search for globally available dictionaries #69

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

DemonTPx
Copy link

@DemonTPx DemonTPx commented Feb 9, 2017

When using GetAvailableDictionaries or SetDictionary, it will search in the given path or known locations where hunspell dictionaries are typically located (/usr/share/hunspell for example.)

This fixes #51 and #54.

No windows support yet I also added windows support!

I've used this script to test it out:

c = require ('./lib/spellchecker');

console.log(c.setDictionary('nl_NL', ''));
console.log(c.checkSpelling('kaas cheese dingen false'));
console.log(c.getCorrectionsForMisspelling('cheese'));
console.log(c.getCorrectionsForMisspelling('false'));

console.log(c.getAvailableDictionaries());

On my machine, this results in:

true
[ { start: 5, end: 11 }, { start: 19, end: 24 } ]
[ 'Heesch', 'Scheeres', 'schee', 'speeches' ]
[ 'valse', 'fase', 'falset', 'falie', 'malse', 'Kalse', 'Fasel' ]
[ 'nl_BE',
  'nl_NL',
  'en_US',
  'en_GB',
  'hyph_en_US',
  'hyph_en_CA',
  'hyph_ga_IE',
  'hyph_fi_FI',
  'hyph_id_ID' ]

Please note that I am not an experienced C++ programmer, so I might do some weird stuff. I'd love to know if anything seems weird and how to fix it.

@winstliu winstliu changed the title Search for globally available dictionaries (on non-windows systems) Search for globally available dictionaries Feb 10, 2017
@JordyMoos
Copy link

+1

@DemonTPx
Copy link
Author

DemonTPx commented Mar 7, 2017

Is there any chance this will be reviewed? Or should I also make a PR to the (bit more active) bdict branch?

@liliakai
Copy link

I much prefer this change over the solution in the bdict branch, mostly because I don't want my app downloading dictionary files from the internet.

@DemonTPx
Copy link
Author

DemonTPx commented Jul 4, 2017

Hey, it seems this project is active at last! Any change this PR could be merged in as well? :)

@IsmaelMartinez
Copy link

Any update on this?

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

Successfully merging this pull request may close these issues.

Check system-wide locations for hunspell
5 participants