From d8bca3bba66ab27ef920033579534b441ee09e46 Mon Sep 17 00:00:00 2001 From: jeanmonet Date: Wed, 26 Aug 2020 22:47:29 +0200 Subject: [PATCH 1/3] Using CyHunspell instead of PyHunspell which is not maintained --- legi/spelling.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/legi/spelling.py b/legi/spelling.py index c1559dd..7465443 100644 --- a/legi/spelling.py +++ b/legi/spelling.py @@ -30,10 +30,10 @@ def __init__(self, lang, filters=(), intra_word_chars=INTRA_WORD_CHARS): import hunspell except ImportError: raise SpellcheckingIsUnavailable("the hunspell module is missing") - paths = self._find_hunspell_files() - if not paths: + path = self._find_hunspell_files() + if not path: raise SpellcheckingIsUnavailable("the hunspell files for lang %r are missing" % lang) - self.dict = hunspell.HunSpell(*paths) + self.dict = hunspell.Hunspell(path) self.filters = filters self.intra_word_chars = set(intra_word_chars) @@ -44,7 +44,7 @@ def _find_hunspell_files(self): aff_path = os.path.join(base_dir, lang + '.aff') dic_path = os.path.join(base_dir, lang + '.dic') if os.path.exists(aff_path) and os.path.exists(dic_path): - return dic_path, aff_path + return os.path.join(base_dir, lang) def check(self, text): """Looks for misspelled words in `text`. From 33946874f60c14c95b5b03e5f948bbf2a8a56171 Mon Sep 17 00:00:00 2001 From: Charly C Date: Mon, 31 May 2021 17:03:50 +0200 Subject: [PATCH 2/3] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 17b98fe..bc25b6d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ appdirs -hunspell +cyhunspell libarchive-c lxml requests From 87c6d13c65aad7472867c4b23978fd6ea2cc32b0 Mon Sep 17 00:00:00 2001 From: Charly C Date: Mon, 31 May 2021 18:57:54 +0200 Subject: [PATCH 3/3] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 69f988c..80a46f0 100644 --- a/README.md +++ b/README.md @@ -15,11 +15,11 @@ en vigueur][tweet-texte-plus-ancien], etc. ## Installation -legi.py a besoin de [`libarchive`][libarchive] et [`hunspell`][hunspell]. L'installation de ces dépendances varie selon le système d'exploitation : +legi.py a besoin de [`libarchive`][libarchive] et d'un dictionnaire français au format d'[`hunspell`][hunspell]. L'installation de ces dépendances varie selon le système d'exploitation : -- Arch Linux : `pacman -S --needed libarchive hunspell hunspell-fr` +- Arch Linux : `pacman -S --needed libarchive hunspell-fr` - Mac OS X : la version de `libarchive` inclue dans Mac OS X est obsolète, vous pouvez utiliser [Homebrew](https://brew.sh/) pour installer une version récente en exécutant `brew install libarchive`, puis indiquer au module Python qu'il doit utiliser cette version en ajoutant une variable d'environnement : `export LIBARCHIVE="$(find "$(brew --cellar libarchive)" -name libarchive.13.dylib | sort | tail -1)"` (cette commande peut être ajoutée au fichier d'initialisation de votre shell, typiquement `~/.bashrc` ou `~/.zshrc`) -- Ubuntu : `sudo apt-get install libarchive13 hunspell hunspell-fr libhunspell-dev` +- Ubuntu : `sudo apt-get install libarchive13 hunspell-fr` Une fois ces dépendances système installées, vous pouvez cloner le dépôt et utiliser `pip` pour installer les modules python nécessaires :