2017 © Pedro PelΓ‘ez
 

project limelight

A php Japanese language text analyzer and parser.

image

nihongodera/limelight

A php Japanese language text analyzer and parser.

  • Monday, January 15, 2018
  • by zachleigh
  • Repository
  • 4 Watchers
  • 17 Stars
  • 4,004 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 34 Versions
  • 35 % Grown

The README.md

Limelight

Latest Stable Version License, (*1)

A php Japanese language analyzer and parser.
  • Split Japanese text into individual, full words
  • Find parts of speech for words
  • Find dictionary entries (lemmas) for conjugated words
  • Get readings and pronunciations for words
  • Build furigana for words
  • Convert Japanese to romaji (English lettering)

Quick Guide

Version Notes

  • April 25, 2016: The Limelight API changed in Version 1.6.0. The new API uses collection methods to give developers better control of Limelight parse results. Please see the wiki for the updated documentation.
  • April 11, 2016: php-mecab, the MeCab bindings Limelight uses, were updated to version 0.6.0 in Dec. 2015 for php 7 support. The pre-0.6.0 bindings no longer work with the master branch of Limelight. If you are using an older version of php-mecab, please update your bindings or use the php-mecab_pre_0.6.0 version.

Install Limelight

Using Docker

From the project root, build the image:, (*2)

docker build -f docker/Dockerfile -t limelight .

Once it is built, run the container:, (*3)

docker run --name limelight -v /host/path/to/limelight:/usr/limelight -d --rm limelight

Access the project in the container:, (*4)

docker exec -it limelight bash

Install composer dependencies from within the container:, (*5)

composer install

Without Docker

Requirements
  • php > 5.6
Dependencies

Before installing Limelight, you must install both mecab and the php extension php-mecab on your system., (*6)

Linux Ubuntu Users

Use the install script included in this repository. The script only works for and php7. Download the script:, (*7)

curl -O https://raw.githubusercontent.com/nihongodera/limelight/master/install_mecab_php-mecab.sh

Make the file executable:, (*8)

chmod +x install_mecab_php-mecab.sh

Execute the script:, (*9)

./install_mecab_php-mecab.sh

You may need to restart your server to complete the process., (*10)

For information about what the script does, see here., (*11)

Other Systems

Please see this page to learn more about installing on your system., (*12)

Install Limelight

Install Limelight through composer., (*13)

composer require nihongodera/limelight

Parse Text

Make a new instance of Limelight\Limelight. Limelight takes no arguments., (*14)

$limelight = new Limelight();

Use the parse() method on the Limelight object to parse Japanese text., (*15)

$results = $limelight->parse('庭でラむムを育てています。');

The returned object is an instance of Limelight\Classes\LimelightResults., (*16)

Get Results

Get results for the entire text using methods available on LimelightResults., (*17)

$results = $limelight->parse('庭でラむムを育てています。');

echo 'Words: ' . $results->string('word') . "\n";
echo 'Readings: ' . $results->string('reading') . "\n";
echo 'Pronunciations: ' . $results->string('pronunciation') . "\n";
echo 'Lemmas: ' . $results->string('lemma') . "\n";
echo 'Parts of speech: ' . $results->string('partOfSpeech') . "\n";
echo 'Hiragana: ' . $results->toHiragana()->string('word') . "\n";
echo 'Katakana: ' . $results->toKatakana()->string('word') . "\n";
echo 'Romaji: ' . $results->string('romaji', ' ') . "\n";
echo 'Furigana: ' . $results->string('furigana') . "\n";

Output: Words: 庭でラむムを育てています。 Readings: γƒ‹γƒ―γƒ‡γƒ©γ‚€γƒ γƒ²γ‚½γƒ€γƒ†γƒ†γ‚€γƒžγ‚Ήγ€‚ Pronunciations: γƒ‹γƒ―γƒ‡γƒ©γ‚€γƒ γƒ²γ‚½γƒ€γƒ†γƒ†γ‚€γƒžγ‚Ήγ€‚ Lemmas: 庭でラむムを育てる。 Parts of speech: noun postposition noun postposition verb symbol Hiragana: にわでらいむをそだてています。 Katakana: γƒ‹γƒ―γƒ‡γƒ©γ‚€γƒ γƒ²γ‚½γƒ€γƒ†γƒ†γ‚€γƒžγ‚Ήγ€‚ Romaji: niwa de raimu o sodateteimasu. Furigana: εΊ­(にわ)でラむムを育(そだ)てています。, (*18)

Alter the collection of words however you like using the library of collection methods., (*19)

Get individual words off the LimelightResults object by using one of several applicable collection methods. Use methods available on the returned LimelightWord object., (*20)

$results = $limelight->parse('庭でラむムを育てています。');

$word1 = $results->pull(2);

$word2 = $results->where('word', 'εΊ­');

echo $word1->string('romaji') . "\n";

echo $word2->string('furigana') . "\n";

Output: raimu 庭にわ, (*21)

Methods on the LimelightResults object and the LimelightWord object follow the same conventions, but LimelightResults methods are plural (words()) while LimelightWord methods are singular (word())., (*22)

Alternatively, loop through all the words on the LimelightResults object., (*23)

$results = $limelight->parse('庭でラむムを育てています。');

foreach ($results as $word) {
    echo $word->word() . ' is a ' . $word->partOfSpeech() . ' read like ' . $word->reading() . "\n";
}

Output: εΊ­ is a noun read like ニワ で is a postposition read like デ ラむム is a noun read like ラむム γ‚’ is a postposition read like ヲ 育てています is a verb read like γ‚½γƒ€γƒ†γƒ†γ‚€γƒžγ‚Ή 。 is a symbol read like 。, (*24)

Full Documentation

Full documentation for Limelight can be found on the Limelight Wiki page., (*25)

Sources, Contributions, and Contributing

The Japanese parsing logic used in Limelight was adapted from Kimtaro's excellent Ruby program Ve. A big thank you to him and all the others who contributed on that project., (*26)

Limelight relies heavily on both MeCab and php-mecab., (*27)

Collection methods and methods in the Arr class were derived from Laravel's collection methods., (*28)

Contributors more than welcome., (*29)

Top, (*30)

The Versions

15/01 2018

dev-master

9999999-dev https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

  • ext-mecab *
  • php >=5.6

 

The Development Requires

by Zach Leigh

language parse japanese kanji furigana romaji mecab

15/01 2018

v1.6.5

1.6.5.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

  • ext-mecab *
  • php >=5.6

 

The Development Requires

by Zach Leigh

language parse japanese kanji furigana romaji mecab

28/01 2017

dev-dev

dev-dev https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

  • ext-mecab *
  • php >=5.6

 

The Development Requires

by Zach Leigh

language parse japanese kanji furigana romaji mecab

28/01 2017

v1.6.4

1.6.4.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

  • ext-mecab *
  • php >=5.6

 

The Development Requires

by Zach Leigh

language parse japanese kanji furigana romaji mecab

30/04 2016

v1.6.3

1.6.3.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

  • ext-mecab *
  • php >=5.6

 

The Development Requires

by Zach Leigh

language parse japanese kanji furigana romaji mecab

27/04 2016

v1.6.2

1.6.2.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

  • ext-mecab *
  • php >=5.6

 

The Development Requires

by Zach Leigh

language parse japanese kanji furigana romaji mecab

26/04 2016

v1.6.1

1.6.1.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

  • ext-mecab *
  • php >=5.6

 

The Development Requires

by Zach Leigh

language parse japanese kanji furigana romaji mecab

25/04 2016

v1.6.0

1.6.0.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

  • ext-mecab *
  • php >=5.6

 

The Development Requires

by Zach Leigh

language parse japanese kanji furigana romaji mecab

19/04 2016

v1.5.2

1.5.2.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

  • ext-mecab *
  • php >=5.6

 

The Development Requires

by Zach Leigh

language parse japanese kanji furigana romaji mecab

18/04 2016

v1.5.1

1.5.1.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

  • ext-mecab *
  • php >=5.6

 

The Development Requires

by Zach Leigh

language parse japanese kanji furigana romaji mecab

11/04 2016

v1.5.0

1.5.0.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

  • ext-mecab *
  • php >=5.6

 

The Development Requires

by Zach Leigh

language parse japanese kanji furigana romaji mecab

11/04 2016

dev-php-mecab_pre_0.6.0

dev-php-mecab_pre_0.6.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

  • ext-mecab *
  • php >=5.6

 

The Development Requires

by Zach Leigh

language parse japanese kanji furigana romaji mecab

11/04 2016

v1.4.10

1.4.10.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

  • ext-mecab *
  • php >=5.6

 

The Development Requires

by Zach Leigh

language parse japanese kanji furigana romaji mecab

11/04 2016

v1.4.9

1.4.9.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

  • ext-mecab *
  • php >=5.6

 

The Development Requires

by Zach Leigh

language parse japanese kanji furigana romaji mecab

11/04 2016

v1.4.8

1.4.8.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

  • ext-mecab *
  • php >=5.6

 

The Development Requires

by Zach Leigh

language parse japanese kanji furigana romaji mecab

11/04 2016

v1.4.7

1.4.7.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

  • ext-mecab *
  • php >=5.6

 

The Development Requires

by Zach Leigh

language parse japanese kanji furigana romaji mecab

11/04 2016

v1.4.6

1.4.6.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

  • ext-mecab *
  • php >=5.6

 

The Development Requires

by Zach Leigh

language parse japanese kanji furigana romaji mecab

07/04 2016

v1.4.5

1.4.5.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Development Requires

by Zach Leigh

language parse japanese kanji furigana mecab romanji

30/01 2016

v1.4.4

1.4.4.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Development Requires

by Zach Leigh

language parse japanese kanji furigana mecab romanji

26/01 2016

v1.4.3

1.4.3.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Development Requires

by Zach Leigh

language parse japanese kanji furigana mecab romanji

24/12 2015

v1.4.2

1.4.2.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Development Requires

by Zach Leigh

language parse japanese kanji furigana mecab romanji

08/12 2015

v1.4.1

1.4.1.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Development Requires

by Zach Leigh

language parse japanese kanji furigana mecab romanji

04/12 2015

v1.4.0

1.4.0.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Development Requires

by Zach Leigh

language parse japanese kanji furigana mecab romanji

30/11 2015

v1.3.4

1.3.4.0 https://github.com/nihongodera/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Development Requires

by Zach Leigh

language parse japanese kanji furigana mecab romanji

27/11 2015

v1.3.3

1.3.3.0 https://github.com/zachleigh/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Development Requires

by Zach Leigh

language parse japanese kanji furigana mecab romanji

14/11 2015

v1.3.2

1.3.2.0 https://github.com/zachleigh/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Development Requires

by Zach Leigh

language parse japanese kanji furigana mecab romanji

09/11 2015

v1.3.1

1.3.1.0 https://github.com/zachleigh/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Development Requires

by Zach Leigh

language parse japanese kanji furigana mecab romanji

08/11 2015

v1.3.0

1.3.0.0 https://github.com/zachleigh/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Development Requires

by Zach Leigh

language parse japanese kanji furigana mecab romanji

04/11 2015

v1.2.2

1.2.2.0 https://github.com/zachleigh/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Development Requires

by Zach Leigh

language parse japanese kanji furigana mecab romanji

02/11 2015

v1.2.1

1.2.1.0 https://github.com/zachleigh/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zach Leigh

language parse japanese kanji furigana mecab romanji

01/11 2015

v1.2.0

1.2.0.0 https://github.com/zachleigh/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zach Leigh

language japanese kanji furigana mecab

30/10 2015

v1.1.0

1.1.0.0 https://github.com/zachleigh/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zach Leigh

language japanese kanji furigana mecab

29/10 2015

v1.0.2

1.0.2.0 https://github.com/zachleigh/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zach Leigh

language japanese mecab

29/10 2015

v1.0.1

1.0.1.0 https://github.com/zachleigh/limelight

A php Japanese language text analyzer and parser.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Zach Leigh

language japanese mecab