Nuspell is a spell checker library and command-line program designed for languages with rich morphology and complex word compounding. Nuspell is a pure C++ reimplementation of Hunspell.
Main features of Nuspell spell checker and morphological analyzer:
- Full unicode support
- Max. 65535 affix classes and twofold affix stripping (for agglutinative languages, like Azeri, Basque, Estonian, Finnish, Hungarian, Turkish, etc.)
- Support complex compounds (for example, Hungarian and German)
- Support language specific features (for example, special casing of Azeri and Turkish dotted i, or German sharp s)
- Handle conditional affixes, circumfixes, fogemorphemes, forbidden words, pseudoroots and homonyms.
- Free software. Licenced under GNU LGPL.
g++ make cmake git ronn
Recommended tools for developers:
qtcreator ninja clang-format gdb vim doxygen
Building on GNU/Linux and Unixes
We first need to download the dependencies. Some may already be preinstalled.
For Ubuntu and Debian:
sudo apt install g++ make cmake libboost-locale-dev libicu-dev
Then run the following commands:
mkdir build cd build cmake .. make sudo make install
For speeding up the build process, run
make -j, or use Ninja instead of Make.
Building on OSX and macOS
- Install Apple's Command-line tools
- Install Homebrew package manager
- Install dependencies
brew install cmake icu4c boost export ICU_ROOT=$(brew --prefix icu4c)
Then run the standard cmake and make. See above. The ICU_ROOT variable is needed
because icu4c is keg-only package in Homebrew and CMake can not find it by
default. Alternatively, you can use
-DICU_ROOT=... on the cmake command line.
If you want to build with GCC instead of Clang, you need to pull GCC with Homebrew and rebuild all the dependencies with it. See Homewbrew manuals.
Building on Windows
1. Compiling with Mingw64 and MSYS2
Download MSYS2, update everything and install the following packages:
pacman -S base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-boost \ mingw-w64-x86_64-cmake
Then from inside the nuspell folder run:
mkdir build cd build cmake .. -G "Unix Makefiles" make make install
2. Building in Cygwin environment
Download the above mentioned dependencies with Cygwin package manager. Then compile the same way as on Linux. Cygwin builds depend on Cygwin1.dll.
Building on FreeBSD (experimental)
Install the following required packages
pkg cmake icu boost-libs
Then run the standard cmake and make as on Linux. See above.
First, always install the debugger:
sudo apt install gdb
It is recomended to install a debug build of the standard library:
sudo apt install libstdc++6-8-dbg
For debugging we need to create a debug build and then we need to start
mkdir debug cd debug cmake .. -DCMAKE_BUILD_TYPE=Debug make -j gdb src/nuspell/nuspell
If you like to develop and debug with an IDE, see documentation at https://github.com/nuspell/nuspell/wiki/IDE-Setup
Testing Nuspell (see tests in tests/ subdirectory):
or with Valgrind debugger:
make test VALGRIND=[Valgrind_tool] make test
make test VALGRIND=memcheck make test
Using the command-line tool
The main executable is located in
After compiling and installing you can run the Nuspell spell checker with a Nuspell, Hunspell or Myspell dictionary:
nuspell -d en_US text.txt
For more details see the man-page.
Using the Library
Including in your program:
Linking with Nuspell static library:
g++ example.cxx -lnuspell -licuuc -licudata # or better, use pkg-config g++ example.cxx $(pkg-config --cflags --libs nuspell)
API Documentation for developers can be generated from the source files by running:
The result can be viewed by opening
doxygen/html/index.html in a web
Myspell, Hunspell and Nuspell dictionaries: