Skip to content

lua-nuspell is a set of Lua 5.x bindings for Nuspell spellchecking C++ library.

License

Notifications You must be signed in to change notification settings

f3fora/lua-nuspell

Repository files navigation

lua-nuspell

lua-nuspell is a set of Lua 5.x bindings for Nuspell spellchecking C++ library.

About Nuspell

Nuspell is a fast and safe spelling checker software program. It is designed for languages with rich morphology and complex word compounding.Nuspell is written in modern C++ and it supports Hunspell dictionaries.

Main features of Nuspell spelling checker:

  • Provides software library and command-line tool.
  • Suggests high-quality spelling corrections.
  • Backward compatibility with Hunspell dictionary file format.
  • Up to 3.5 times faster than Hunspell.
  • Full Unicode support backed by ICU.
  • Twofold affix stripping (for agglutinative languages, like Azeri, Basque, Estonian, Finnish, Hungarian, Turkish, etc.).
  • Supports complex compounds (for example, Hungarian, German and Dutch).
  • Supports advanced features, for example: special casing rules (Turkish dotted i or German sharp s), conditional affixes, circumfixes, fogemorphemes, forbidden words, pseudoroots and homonyms.
  • Free and open source software. Licensed under GNU LGPL v3 or later.

Status

Test

Tested only on Linux. Feedback wanted!

Requirements

  • nuspell

Installation

luarocks install lua-nuspell

from RockSpec

Clone and build.

luarocks make --local

from Source

Clone and compile for example for Lua 5.1.

g++ -fPIC -shared -lnuspell -std=c++17 -I/usr/include/lua5.1/ -o nuspell.so src/nuspell.cxx

Documentation

Documentation is available with

luarocks doc lua-nuspell

Otherwise, it can be generated with LDoc by running

ldoc .

And the result can be viewed by opening doc/index.html in a web browser.

Minimal Example

local nuspell = require('nuspell')
local unpack = table.unpack or unpack
local word = 'Hello'
local lang = 'en_US'

local dirs = nuspell.get_default_dir_paths()
local aff = nuspell.search_dirs_for_one_dict(dirs, lang)
local dict = nuspell.Dictionary.load_aff_dic(aff)

print(dict:spell(word))
print(unpack(dict:suggest(word)))

License

lua-nuspell is licensed under the LGPL version 3 or later, see LICENSE for more information.

About

lua-nuspell is a set of Lua 5.x bindings for Nuspell spellchecking C++ library.

Resources

License

Stars

Watchers

Forks

Packages

No packages published