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

Related tags

Audio lua-nuspell
Overview

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

from LuaRocks

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.search_default_dirs_for_dicts()
local dict = nuspell.Dictionary.load_from_path(nuspell.find_dictionary(dirs, lang))
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.

Issues
  • Testing builds on Big Sur (macOS)

    Testing builds on Big Sur (macOS)

    This was the result

    ❯ ICU_ROOT=/usr/local/opt/icu4c luarocks install lua-nuspell
    Installing https://luarocks.org/lua-nuspell-0.3alpha-1.src.rock
    
    lua-nuspell 0.3alpha-1 depends on lua >= 5.1 (5.4-1 provided by VM)
    Warning: unmatched variable LUA_LIBDIR_FILE
    Warning: unmatched variable LUA_LIBDIR
    Warning: unmatched variable CMAKE_BUILD_TYPE
    -- The CXX compiler identification is AppleClang 13.0.0.13000029
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Found the following ICU libraries:
    --   uc (required)
    --   data (required)
    -- Found ICU: /usr/local/opt/icu4c/include (found version "69.1")
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /var/folders/_7/lk2n6mlj06sd3bs38fntwv2s8yf8_m/T/luarocks_lua-nuspell-0.3alpha-1-yYh6mf/lua-nuspell/build.luarocks
    [ 50%] Building CXX object CMakeFiles/nuspell.dir/src/nuspell.cxx.o
    [100%] Linking CXX shared module nuspell.so
    ld: warning: dylib (/usr/local/lib/libnuspell.5.0.0.dylib) was built for newer macOS version (11.0) than being linked (10.15)
    ld: warning: dylib (/usr/local/opt/icu4c/lib/libicuuc.dylib) was built for newer macOS version (11.0) than being linked (10.15)
    ld: warning: dylib (/usr/local/opt/icu4c/lib/libicudata.dylib) was built for newer macOS version (11.0) than being linked (10.15)
    Undefined symbols for architecture x86_64:
      "_luaL_checklstring", referenced from:
          l_search_dirs_for_dicts(lua_State*) in nuspell.cxx.o
          l_find_dictionary(lua_State*) in nuspell.cxx.o
          l_Dictionary_load_from_path(lua_State*) in nuspell.cxx.o
          l_Dictionary_spell(lua_State*) in nuspell.cxx.o
          l_Dictionary_suggest(lua_State*) in nuspell.cxx.o
      "_luaL_checktype", referenced from:
          l_search_dirs_for_dicts(lua_State*) in nuspell.cxx.o
          l_find_dictionary(lua_State*) in nuspell.cxx.o
      "_luaL_checkudata", referenced from:
          l_Dictionary_spell(lua_State*) in nuspell.cxx.o
          l_Dictionary_suggest(lua_State*) in nuspell.cxx.o
          l_Dictionary_destructor(lua_State*) in nuspell.cxx.o
      "_luaL_checkversion_", referenced from:
          _luaopen_nuspell in nuspell.cxx.o
      "_luaL_error", referenced from:
          l_Dictionary_load_from_path(lua_State*) in nuspell.cxx.o
      "_luaL_newmetatable", referenced from:
          _luaopen_nuspell in nuspell.cxx.o
      "_luaL_setfuncs", referenced from:
          _luaopen_nuspell in nuspell.cxx.o
      "_lua_createtable", referenced from:
          _luaopen_nuspell in nuspell.cxx.o
          l_get_default_dir_paths(lua_State*) in nuspell.cxx.o
          l_get_libreoffice_dir_paths(lua_State*) in nuspell.cxx.o
          l_Dictionary_suggest(lua_State*) in nuspell.cxx.o
          return_array_of_pairs(lua_State*, std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >&) in nuspell.cxx.o
      "_lua_getfield", referenced from:
          l_Dictionary_load_from_path(lua_State*) in nuspell.cxx.o
      "_lua_newuserdatauv", referenced from:
          l_Dictionary_load_from_path(lua_State*) in nuspell.cxx.o
      "_lua_pushboolean", referenced from:
          l_Dictionary_spell(lua_State*) in nuspell.cxx.o
      "_lua_pushnil", referenced from:
          l_find_dictionary(lua_State*) in nuspell.cxx.o
      "_lua_pushstring", referenced from:
          _luaopen_nuspell in nuspell.cxx.o
          l_get_default_dir_paths(lua_State*) in nuspell.cxx.o
          l_get_libreoffice_dir_paths(lua_State*) in nuspell.cxx.o
          l_find_dictionary(lua_State*) in nuspell.cxx.o
          l_Dictionary_suggest(lua_State*) in nuspell.cxx.o
          return_array_of_pairs(lua_State*, std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >&) in nuspell.cxx.o
      "_lua_pushvalue", referenced from:
          _luaopen_nuspell in nuspell.cxx.o
      "_lua_rawgeti", referenced from:
          l_search_dirs_for_dicts(lua_State*) in nuspell.cxx.o
          l_find_dictionary(lua_State*) in nuspell.cxx.o
      "_lua_rawlen", referenced from:
          l_search_dirs_for_dicts(lua_State*) in nuspell.cxx.o
          l_find_dictionary(lua_State*) in nuspell.cxx.o
      "_lua_rawseti", referenced from:
          l_get_default_dir_paths(lua_State*) in nuspell.cxx.o
          l_get_libreoffice_dir_paths(lua_State*) in nuspell.cxx.o
          l_Dictionary_suggest(lua_State*) in nuspell.cxx.o
          return_array_of_pairs(lua_State*, std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >&) in nuspell.cxx.o
      "_lua_setfield", referenced from:
          _luaopen_nuspell in nuspell.cxx.o
      "_lua_setmetatable", referenced from:
          l_Dictionary_load_from_path(lua_State*) in nuspell.cxx.o
      "_lua_settop", referenced from:
          l_search_dirs_for_dicts(lua_State*) in nuspell.cxx.o
          l_find_dictionary(lua_State*) in nuspell.cxx.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [nuspell.so] Error 1
    make[1]: *** [CMakeFiles/nuspell.dir/all] Error 2
    make: *** [all] Error 2
    
    Error: Build error: Failed building.
    
    opened by hurricanehrndz 17
  • Update nuspell version in CI

    Update nuspell version in CI

    The PPA won't be updated anymore, and it should not be used because it will get retired. So now it's better to install nuspell from source.

    Once newer Ubuntu (22.04) gets into Github Actions, there won't be need for PPA nor for building from source, just apt get libnuspell-dev.

    opened by dimztimz 0
  • Fails to install on macOS (12.3)

    Fails to install on macOS (12.3)

    $ brew tap nuspell/nuspell
    $ brew install nuspell
    

    The above installs nuspell & icu4c, which is a "keg-only" Homebrew formula, meaning it is not symlinked into the Homebrew base prefix. This formula sets ICU_ROOT as it's calling cmake directly: https://github.com/nuspell/homebrew-nuspell/blob/master/Formula/nuspell.rb

    $ luarocks install lua-nuspell
    Installing https://luarocks.org/lua-nuspell-0.3alpha-1.src.rock
    
    lua-nuspell 0.3alpha-1 depends on lua >= 5.1 (5.4-1 provided by VM)
    Warning: unmatched variable LUA_LIBDIR_FILE
    Warning: unmatched variable CMAKE_BUILD_TYPE
    Warning: unmatched variable LUA_LIBDIR
    -- The CXX compiler identification is AppleClang 13.1.6.13160021
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Found the following ICU libraries:
    --   uc (required)
    --   data (required)
    CMake Error at /opt/homebrew/Cellar/cmake/3.22.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
      Failed to find all ICU components (missing: ICU_LIBRARY) (found version
      "70.1")
    Call Stack (most recent call first):
      /opt/homebrew/Cellar/cmake/3.22.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
      /opt/homebrew/Cellar/cmake/3.22.3/share/cmake/Modules/FindICU.cmake:335 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
      /opt/homebrew/Cellar/cmake/3.22.3/share/cmake/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
      /opt/homebrew/lib/cmake/nuspell/NuspellConfig.cmake:2 (find_dependency)
      CMakeLists.txt:18 (find_package)
    

    I can compile manually and avoid cmake via:

    PKG_CONFIG_PATH=/opt/homebrew/Cellar/icu4c/*/lib/pkgconfig c++ -fPIC -shared -std=c++17 (pkg-config lua nuspell --libs --cflags | string split -n " ") -o nuspell.so src/nuspell.cxx

    However that is not packer friendly.

    Any suggestions here? I'm not really familiar with cmake.

    opened by dsully 4
C++ library for audio and music analysis, description and synthesis, including Python bindings

Essentia Essentia is an open-source C++ library for audio analysis and audio-based music information retrieval released under the Affero GPL license.

Music Technology Group - Universitat Pompeu Fabra 2.2k Aug 8, 2022
A next generation media player, with vim-like bindings

MusicKid A next generation media player, with vim-like bindings Installation Clone the repo git clone <git-url> cd MusicKid/Final Install dependencies

null 4 Jan 10, 2022
A set of audio processing functions implemented by FPGA

FPGAudio This project is a set of audio processing functions on FPGA board, using Verilog language. The FPGA used in this project is ALETRA EP4CE10F17

Yuyang Zhou 13 Jan 21, 2022
A simple C++ library for reading and writing audio files.

AudioFile A simple header-only C++ library for reading and writing audio files. Current supported formats: WAV AIFF Author AudioFile is written and ma

Adam Stark 615 Aug 2, 2022
A C library for reading and writing sound files containing sampled audio data.

libsndfile libsndfile is a C library for reading and writing files containing sampled audio data. Authors The libsndfile project was originally develo

null 1k Aug 4, 2022
C library for cross-platform real-time audio input and output

libsoundio C library providing cross-platform audio input and output. The API is suitable for real-time software such as digital audio workstations as

Andrew Kelley 1.6k Aug 7, 2022
C++ Audio and Music DSP Library

_____ _____ ___ __ _ _____ __ __ __ ____ ____ / \\_ \\ \/ / |/ \| | | | \_ \/ \ | Y Y \/ /_ \> <| | Y Y \ | |_|

Mick Grierson 1.3k Aug 3, 2022
Single file audio playback and capture library written in C.

A single file library for audio playback and capture. Example - Documentation - Supported Platforms - Backends - Major Features - Building - Unofficia

David Reid 2.4k Aug 10, 2022
Minimalistic MP3 decoder single header library

minimp3 Minimalistic, single-header library for decoding MP3. minimp3 is designed to be small, fast (with SSE and NEON support), and accurate (ISO con

Lion 1.2k Aug 8, 2022
🎵 Music notation engraving library for MEI with MusicXML and Humdrum support and various toolkits (JavaScript, Python)

Verovio is a fast, portable and lightweight library for engraving Music Encoding Initiative (MEI) digital scores into SVG images. Verovio also contain

RISM Switzerland 493 Aug 12, 2022
highly efficient sound library for the Gameboy Advance

The Apex Audio System (AAS) is a sound library for the GBA. It includes a highly efficient mixer, MOD playing routines and support for up to 16 channels. It is designed for developers using a GCC-based development environment. AAS uses RAW, WAV or *tracker 1-16 channel MOD files as input.

Ties Stuij 31 Jul 15, 2022
A lightweight music DSP library.

Soundpipe Soundpipe is a lightweight music DSP library written in C. It aims to provide a set of high-quality DSP modules for composers, sound designe

Paul Batchelor 102 Dec 14, 2021
PortAudio is a portable audio I/O library designed for cross-platform support of audio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.

PortAudio 668 Aug 2, 2022
LibMEI is a C++ library for reading and writing MEI files

C++ library and Python bindings for the Music Encoding Initiative format

Distributed Digital Music Archives and Libraries Lab 54 May 31, 2022
C++17 library for creating macOS Audio Server plugins.

libASPL Synopsis Instructions Versioning API reference Example driver Quick start Object model Types of setters Customization Thread and realtime safe

Victor Gaydov 26 Jul 27, 2022
a library for audio and music analysis

aubio is a library to label music and sounds. It listens to audio signals and attempts to detect events. For instance, when a drum is hit, at which frequency is a note, or at what tempo is a rhythmic melody.

aubio 2.8k Aug 8, 2022
Cross-platform silk codec wrap library depends on ploverlake/silk.

libSilkCodec Cross-platform silk codec wrap library depends on ploverlake/silk. Clone & Build Linux/Unix like # clone $ git clone https://github.c

KonataDev 7 Jul 18, 2022
SSMLSDL - Simple Sound Manipulation Library, Based on SDL and LIBWAV.

SSM-lib SSMLSDL - Simple Sound Manipulation Library, Based on SDL and LIBWAV. This library is open source and free software. It's aims to provide YOU,

UtoECat 1 Jan 20, 2022
Library and command line backend for the Raspberry Pi OPL3 emulator and midi player

About this repository This repository holds the source code for the pioplemidi backend. You can compile it if you only want to use the library or the

iAmInAction 2 Dec 2, 2021