PHP code example of oblak / syllabizer

1. Go to this page and download the library: Download oblak/syllabizer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

oblak / syllabizer example snippets




blak\Syllabizer;

$syllabizer = new Syllabizer();

$syllabizer->syllabize('jednak');   // ['jed', 'nak']
$syllabizer->syllabize('tramvaj');  // ['tram', 'vaj']
$syllabizer->syllabize('pidžama');  // ['pi', 'dža', 'ma']
$syllabizer->syllabize('mačka');    // ['ma', 'čka']

// Cyrillic works just as well
$syllabizer->syllabize('сломљен');  // ['слом', 'љен']

// Syllabic R (slogotvorno r) is a nucleus of its own
$syllabizer->syllabize('brzo');     // ['br', 'zo']
$syllabizer->syllabize('rđa');      // ['r', 'đa']

// Count the syllables
count($syllabizer->syllabize('slogovnik')); // 3

$word = 'doneti';

implode('', $syllabizer->syllabize($word)) === $word; // true

$syllabizer->tokenize('doneti');        // 'do-ne-ti'
$syllabizer->tokenize('сломљен');       // 'слом-љен'

// Pass any separator you like
$syllabizer->tokenize('doneti', '·');   // 'do·ne·ti'