DOWNLOAD ASPELL
Download and extract GNU Aspell 0.60.6.1 from http://aspell.net/Download and extract the English dictionary (aspell6-en-2016.01.19-0.tar.bz2)
INSTALL CHOCOLATEY MACHINE PACKAGE MANAGER
Start PowerShell as AdministratorEnter the following commands:
Set-ExecutionPolicy ByPass
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
INSTALL THE BUILD TOOLS
Start cmd as AdministratorEnter the following commands:
choco install msys2
choco install mingw
choco install activeperl
choco install linkshellextension
Start msys2_shell.bat in C:\tools\msys2
Enter the following commands:
pacman -S make
pacman -S diffutils
UPDATE BUILD SCRIPT
Overwrite config.guess with file from http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
Overwrite config.sub with file from http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
BUILD
In msys2 shell, navigate to downloaded AspellEnter:
./configure CXXFLAGS='-O2' --enable-win32-relocatable --disable-rpath --prefix="C:/tools/Aspell" --enable-data-dir="C:/tools/Aspell/data" --enable-dict-dir="C:/tools/Aspell/data"
In the downloaded Aspell, add the file gen/dirs.h with the following contents
#define PREFIX "C:/tools/Aspell"
#define DATA_DIR "C:/tools/Aspell/data"
#define DICT_DIR DATA_DIR
#define CONF_DIR PREFIX
Add a line to common/file_util.cpp under the “#ifdef WIN32” section
#include "asc_ctype.hpp"
In msys2 shell, enter
make
make install
Add
C:\tools\Aspell\bin
to PATH system environment variableCreate hardlink from C:\tools\Aspell\data (drop as hardlink) to C:\tools\Aspell\lib\aspell-0.60 (pick link source)
Restart msys2 shell and navigate to downloaded Aspell dictionary and enter
./configure
make
make install
FINAL STEPS
Open cmd, navigate to c:\tools\Aspell\bin and enter
aspell dump config > ../aspell.conf
encoding utf-8
below # default: !encoding = none
Add
sug-mode bad-spellers
below
# sug-mode (string)
# suggestion mode
# default: normal
TO USE IN ASPELL IN PYTHON
Download aspell-python from http://www.lfd.uci.edu/~gohlke/pythonlibs/In cmd, navigate to c:\tools\python\Scripts and enter
pip install [path to the file aspell-python.whl]
Create symbolic link from C:\ProgramData\Aspell to C:\tools\Aspell
Create symbolic link from C:\tools\Aspell\Dictionaries\en_US to C:\tools\Aspell\data
Start Python
import aspell
spell = aspell.Speller()
enc = spell.ConfigKeys()['encoding'][1]
print(spell.suggest('mispelling'.encode(enc)))
Credits:
http://nosq.com/2005/07/aspell-0603-for-win32/
https://github.com/WojciechMula/aspell-python/blob/master/windows.rst
No comments:
Post a Comment