Skip to content
Zach Leigh edited this page Apr 12, 2016 · 6 revisions

Contents

General

LimelightWord objects contain all information gained from the Limelight parse() method. Each LimelightWord object holds information for exactly one word. Unlike LimelightResults methods which are plural, LimelightWord methods are all singular.

All examples in this section will use the following text.

$results = $limelight->parse('イギリス人のことを 「ライム野郎 (limey)」 と呼びます。');

Method Index

Basic Methods
Conversion Methods
Other Methods

Basic Methods

All basic methods follow the same general syntax.

/**
 * Get property.
 *
 * @return string/array
*/
method();

get()

Get the word.

$word = $results->findIndex(0);

echo $word->get();

Output: イギリス人


word()

Get the word.

$word = $results->findIndex(0);

echo $word->word();

Output: イギリス人


reading()

Get the word's reading.

$word = $results->findIndex(6);

echo $word->reading();

Output: ヤロウ


pronunciation()

Get the word's pronunciation. Long vowels are denoted by 'ー'.

$word = $results->findIndex(6);

echo $word->pronunciation();

Output: ヤロー


lemma()

Get the word's lemma (dictionary form).

$word = $results->findIndex(12);

echo $word->lemma();

Output: 呼ぶ


partOfSpeech()

Get the word's part of speech.

$word = $results->findIndex(0);

echo $word->partOfSpeech();

Output: proper noun


grammar()

Get any grammar notes for the word. Most words do not yet have grammar notes.

$word = $results->findIndex(0);

$word->grammar();

rawMecab()

Get the word's Mecab tokens. Output will be an array of token arrays.

$word = $results->findIndex(5);

print_r($word->rawMecab());

Output
Array
  (
    [0] => Array
      (
        [type] => parsed
        [literal] => ライム
        [partOfSpeech1] => meishi
        [partOfSpeech2] => 一般
        [partOfSpeech3] => *
        [partOfSpeech4] => *
        [inflectionType] => *
        [inflectionForm] => *
        [lemma] => ライム
        [reading] => ライム
        [pronunciation] => ライム
      )
)

Conversion Methods

Conversion methods can be used before the above properties to convert items to hiragana, katakana, furigana, or romaji. Furigana and romaji conversion is performed by plugins. These plugins are activated by default, but if they have been deleted or un-registered in config.php, the conversion will fail.

All methods take no arguments.


toHiragana()

Convert text to hiragana.

$word = $results->findIndex(0);

echo $word->toHiragana()->word();

Output: いぎりすじん


toKatakana()

Convert text to katakana.

$word = $results->findIndex(12);

echo $word->toKatakana()->word();

Output: ヨビマス


toFurigana()

Convert text to furigana.

$word = $results->findIndex(12);

echo $word->toFurigana()->word();

Output: びます


toRomaji()

Convert text to romaji.

$word = $results->findIndex(0);

echo $word->toRomaji()->word();

Output: Igirisujin

Other Methods

__toString()

Get basic info about word.

$word = $results->findIndex(6);

echo $word;

Output:
Word: 野郎
Part of Speech: noun
Lemma: 野郎
Reading: ヤロウ
Pronunciation: ヤロー

Clone this wiki locally