Skip to content

siiptuo/voikko-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

voikko-php

PHP bindings for libvoikko based on PHP FFI.

Requirements

  • PHP 7.4 or newer with FFI and Multibyte String extensions enabled
  • libvoikko (libvoikko1 package in Ubuntu)
  • Voikko dictionary (voikko-fi package in Ubuntu)

Installation

Install via Composer:

composer require siiptuo/voikko

Example

Running:

$voikko = new \Siiptuo\Voikko\Voikko();
$word = "kissammeko";
echo "       word: " . $word . PHP_EOL;
echo "hyphenation: " . $voikko->hyphenate($word) . PHP_EOL;
foreach ($voikko->analyzeWord($word) as $analysis) {
    echo "  base form: " . $analysis->baseForm . PHP_EOL;
}

outputs:

       word: kissammeko
hyphenation: kis-sam-me-ko
  base form: kissa

Check out API documentation for all available functionality.

License

Like libvoikko, these bindings can be used under one of the following licenses:

  • Mozilla Public License, version 1.1
  • GNU General Public License, version 2 or later
  • GNU Lesser General Public License, version 2.1 or later