wooorm / dictionaries

Hunspell dictionaries in UTF-8
MIT License
1.21k stars 398 forks source link

dictionnary-fr issue #16

Closed revolunet closed 5 years ago

revolunet commented 5 years ago

Hi there !

Looks like the suggest/correct methods doesnt handle some words in french, like "préavis"

in index.dic we can find : préavis po:nom is:mas is:inv

but console.log(spell.correct("preavis")); returns false.

Any idea how to fix this ?

wooorm commented 5 years ago

Hmm, are you sure you’re on the latest release? (there was a bug which sounds similar https://github.com/wooorm/nspell/commit/a55923ee37ae5c7746c4fa96ed3d68b3e9f20a30)

wooorm commented 5 years ago

Also hi Julien! 👋😅

revolunet commented 5 years ago

hi :)

revolunet commented 5 years ago

using :

"dictionary-fr": "^2.3.1",
"nspell": "^2.1.2"
wooorm commented 5 years ago

but console.log(spell.suggest("preavis")); returns false.

.suggest should return an array, .correct could return false, which one’s going on here?


Could be related to the fact that MAP, used in dictionary-fr, is not supported in nspell... But I would think the TRY should still make it work

revolunet commented 5 years ago

sorry, wrong copy/paste :)

both method return falsy result in that case.

correct return false suggest return wrong results

revolunet commented 5 years ago
var dictionary = require("dictionary-fr");
var nspell = require("nspell");

dictionary(ondictionary);

function ondictionary(err, dict) {
  if (err) {
    throw err;
  }

  var spell = nspell(dict);

  console.log(spell.correct("préavis"));
  console.log(spell.suggest("preavis"));
}
~/D/p/m/c/tests-dicts $ node test.js                                                                                           17:42:41
false
[ 'préavisa', 'préavise', 'preuves' ]
wooorm commented 5 years ago

Huh, in fact. Seems like the dictionary is incorrect.

préavis po:nom is:mas is:inv should just be préavis. And grammalecte has other packages that include valid (for hunspell) dictionaries. I’ll try and fix this tomorrow!

revolunet commented 5 years ago

tell me if theres any way we can help :)

wooorm commented 5 years ago

Released dictionary-fr with a hopefully working version. Could you check that this one works?

revolunet commented 5 years ago

Awesome that fix it. Thanks @wooorm 🙏