LoginSignup
29
33

More than 5 years have passed since last update.

Macで日本語音声認識

Posted at

Juliusでやる

ドキュメント
http://julius.sourceforge.jp/juliusbook/ja/

--enable-words-int, --with-mictypeとか必要そうなオプションの意味が書いている

インストール

flexのインストール

とりあえず必要と書いてあったので。これはbrewで一発。

brew install flex

portaudioのインストール

brewだとlinkするところでエラーが出てしまった。

ネット上にいろんな情報があるが、

pa_stable_v19_20140130.tgzは特に何も指定しない普通のソースからコンパイルでいけた

tar xvzf pa_stable_v19_20140130.tgz
cd portaudio/
./configure --enable-words-int
make
sudo make install

解析

とりあえず、以下のURLからディクテーションキットをダウンロードする。これにはJuliusのバイナリがついてくるのでインストールが不要。

Mac用の最新は書いている時点ではdictation-kit-v4.3.1-osx.tgzだった。

tar xvzf dictation-kit-v4.3.1-osx.tgz
cd dictation-kit-v4.3.1-osx
./run-gmm.sh

これでマイクに向かって話したら、精度悪い感じで認識してくれる。

----------------------- System Information end -----------------------

Notice for feature extraction (01),
    *************************************************************
    * Cepstral mean normalization for real-time decoding:       *
    * NOTICE: The first input may not be recognized, since      *
    *         no initial mean is available on startup.          *
    *************************************************************

Stat: adin_portaudio: audio cycle buffer length = 256000 bytes
Stat: adin_portaudio: sound capture devices:
  2 [Core Audio: Built-in Microph]
  4 [Core Audio: USB PnP Sound Device]
Stat: adin_portaudio: use default device
Stat: adin_portaudio: [Core Audio: USB PnP Sound Device]
Stat: adin_portaudio: (you can specify device by "PORTAUDIO_DEV_NUM=number"
Stat: adin_portaudio: try to set default low latency from portaudio: 3 msec
Stat: adin_portaudio: latency was set to 42.000000 msec
STAT: AD-in thread created
pass1_best:  左右 の で 、           
sentence1:  左右 の 音 。
<<< please speak >>>

homebrewでインストールしたい場合

brew install julius julius-dictation-kit

で出来る。

実行ファイルは
/usr/local/Cellar/julius/4.2.3/bin/julius
に作成され、このディレクトリの中には他のいろいろなツールも含まれているのでJulius関係のツールはこの中にないか探すと良い

fruitモデルで実験

fruit.tar.gzdictadictation-kit-v4.3.1-osx直下にダウンロードして展開

julian_fruit_light.jconfを以下のように書き換える

fruit/julian_fruit_light.jconf
- -h ../model/phone_m/hmmdefs_monof_mix16_git.binhmm
+ -h ../model/phone_m/janas_mono_mix16_git.binhmm

brewでdictation-kitをインストールしていれば/usr/local/Cellar/julius-dictation-kit/4.2.3/share/model/phone_m/hmmdefs_monof_mix16_gid.binhmmを参照させたのでもOK。

実行は、

./bin/julius -C fruit/julian_fruit_light.jconf -charconv SHIFT_JIS UTF-8

もしくは、dict, vocなどを全てUTF-8に直した上(nkf -w --in-place *)で、

./bin/julius -C fruit/julian_fruit_light.jconf

とする。

ここまでやった部分は以下に上げておいた。
https://github.com/awakia/julius-dictation-kit-v4.3.1-osx

記述文法について
http://julius.sourceforge.jp/juliusbook/ja/desc_lm.html#id2537489

入力

  • grammar ファイル: 構文制約を単語のカテゴリを終端規則として記述する.
  • voca ファイル: カテゴリごとに単語の表記と読み(音素列)を登録する.

音素

a, i, u, e, o
a:, i:, u:, e:, o:
N, w, y, j, 
my, ky, by, gy, ny, hy, ry, py
p, t, k, ts, ch, b, d, dy, g, z
m, n, s, sh, h, f, r, q

/usr/local/Cellar/julius/4.2.3/bin/mkdfa.pl

その他参考になりそうなリンク

http://shower.human.waseda.ac.jp/~m-kouki/pukiwiki_public/24.html
http://futurismo.biz/archives/136
http://netakiri.net/diary/archives/483.html
http://tips.hecomi.com/entry/20120111/1326296629

29
33
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
29
33