Skip to content

ProgrammingLanguages

Tuomas Siipola edited this page May 15, 2021 · 9 revisions

Using Voikko in your own software projects

C and C++

Libvoikko is a C++ library with plain C interface. Thus you can use it in applications that are developed either in C or C++. You need to

#include <libvoikko/voikko.h>

and link against the libvoikko library (-lvoikko or similar). The header file has detailed comments and some general instructions on how to use the library.

Python

Libvoikko comes with a Python module that supports all the functionality of the library. The interface is object oriented and easier to use than the corresponding C interface. The module uses the native libvoikko library through ctypes module. The module is compatible with Python 2.7 and later, including Python 3.

Java

Libvoikko can be accessed from Java. The interface is object oriented and very similar to our Python interface. For more information and API documentation see java/install.

JavaScript

Libvoikko can be compiled into pure JavaScript using Emscripten. It also comes with wrapper API that makes it possible to access the library just as you would do in Java or Python. The API is not yet finalised and pre-compiled packages are still missing. Meanwhile you can look at https://www.puimula.org/htp/testing/js-libvoikko/js-libvoikko-demo.html for a sample and adapt it to your needs.

TypeScript

TypeScript typings for JavaScript port are available in source repository.

C# and other .NET languages

Libvoikko contains an object oriented wrapper interface written in C# that can be compiled into a .NET assembly. It is (again) very similar to Python and Java interfaces mentioned above. For more information see cs/install.

Common Lisp

The Common Lisp interface currently supports Libvoikko's spelling checker, spelling suggestions, hyphenation and word analysis functions. It requires The Common Foreign Function Interface (CFFI). See also this mailing list message from Teemu Likonen (in Finnish).

Rust

Rust bindings for libvoikko are available at https://github.com/ronjakoi/voikko-rs .

PHP

PHP bindings for libvoikko are available in siiptuo/voikko from Packagist. Spell checking functionality of libvoikko can also be used by taking advantage of Enchant module within core PHP packages.

Lua

Lua bindings for libvoikko are available at https://github.com/ahomansikka/lualibvoikko .

Shell scripts

Libvoikko provides three executables, voikkospell, voikkohyphenate and voikkogc that allow you to access most of the functionality of the library from shell scripts. See the manual pages for more information.