日本語ディクテーションのお試し

PCによるディクテーションにちょいと興味が有り、やり散らかしてみた。

同音異義語の多い日本語では、音響モデルによる音素の決定の他に、文法やコンテクストから類推しなければならないという障壁もある。結局、気軽に試すことのできる日本語でのディクテーションは、juliusのみだと思う。

juliusは京都大学奈良先端大学のプロジェクトみたいだ。サイト、


からダウンロードし、適当にビルドしておく。下は、とあるニュース原稿で試した結果だ。

~/Downloads/julius-4.2.3$ cat NEWS-16.wav | julius -C dictation-kit-v4.2.3/fast.jconf -m 5000 -nostrip -charconv EUC-JP UTF-8 -input stdin
STAT: include config: dictation-kit-v4.2.3/fast.jconf
STAT: jconf successfully finalized
STAT: *** loading AM00 _default
Stat: init_phmm: Reading in HMM definition
Stat: read_binhmm: binary format HMM definition
Stat: read_binhmm: this HMM does not need multipath handling
Stat: init_phmm: defined HMMs:  7946
Stat: init_phmm: loading ascii hmmlist
Stat: init_phmm: logical names: 21424 in HMMList
Stat: init_phmm: base phones:    43 used in logical
Stat: init_phmm: finished reading HMM definitions
STAT: making pseudo bi/mono-phone for IW-triphone
Stat: hmm_lookup: 10 pseudo phones are added to logical HMM list
STAT: *** AM00 _default loaded
STAT: *** loading LM00 _default
Stat: init_voca: read 60250 words
Stat: init_ngram: reading in binary n-gram from dictation-kit-v4.2.3/model/lang_m/web.60k.8-8.bingramv5.gz
Warning: ngram_read_bin: 2-bytes bingram, converting to 4 bytes
Stat: ngram_read_bin: file version: 5
Stat: ngram_read_bin: word-id size conversion enabled
Stat: ngram_read_bin_v5: this is backward 3-gram file
stat: ngram_read_bin_v5: reading 1-gram
stat: ngram_read_bin_v5: reading 2-gram
stat: ngram_read_bin_v5: reading 3-gram
Stat: ngram_read_bin_v5: reading additional LR 2-gram
Stat: ngram_read_bin: making entry name index
Stat: init_ngram: found unknown word entry "<UNK>"
Stat: init_ngram: finished reading n-gram
Stat: init_ngram: mapping dictonary words to n-gram entries
Stat: init_ngram: finished word-to-ngram mapping
STAT: *** LM00 _default loaded
STAT: ------
STAT: All models are ready, go for final fusion
STAT: [1] create MFCC extraction instance(s)
STAT: *** create MFCC calculation modules from AM
STAT: AM 0 _default: create a new module MFCC01
STAT: 1 MFCC modules created
STAT: [2] create recognition processing instance(s) with AM and LM
STAT: composing recognizer instance SR00 _default (AM00 _default, LM00 _default)
STAT: Building HMM lexicon tree
STAT: lexicon size: 464034+19121=483155
STAT: coordination check passed
STAT: make successor lists for unigram factoring
STAT: done
STAT:  1-gram factoring values has been pre-computed
STAT: SR00 _default composed
STAT: [3] initialize for acoustic HMM calculation
Stat: outprob_init: all mixture PDFs are tied-mixture, use calc_tied_mix()
Stat: addlog: generating addlog table (size = 1953 kB)
Stat: addlog: addlog table generated
STAT: [4] prepare MFCC storage(s)
STAT: All init successfully done

STAT: ###### initialize input device
----------------------- System Information begin ---------------------
JuliusLib rev.4.2.3 (fast)

Engine specification:
 -  Base setup   : fast
 -  Supported LM : DFA, N-gram, Word
 -  Extension    : WordsInt LibSndFile
 -  Compiled by  : gcc -g -O2

------------------------------------------------------------
Configuration of Modules

 Number of defined modules: AM=1, LM=1, SR=1

 Acoustic Model (with input parameter spec.):
 - AM00 "_default"
	hmmfilename=dictation-kit-v4.2.3/model/phone_m/hmmdefs_ptm_gid.binhmm
	hmmmapfilename=dictation-kit-v4.2.3/model/phone_m/logicalTri

 Language Model:
 - LM00 "_default"
	vocabulary filename=dictation-kit-v4.2.3/model/lang_m/web.60k.htkdic
	n-gram  filename=dictation-kit-v4.2.3/model/lang_m/web.60k.8-8.bingramv5.gz (binary format)

 Recognizer:
 - SR00 "_default" (AM00, LM00)

------------------------------------------------------------
Speech Analysis Module(s)

[MFCC01]  for [AM00 _default]

 Acoustic analysis condition:
	       parameter = MFCC_E_D_N_Z (25 dim. from 12 cepstrum + energy, abs energy supressed with CMN)
	sample frequency = 16000 Hz
	   sample period =  625  (1 = 100ns)
	     window size =  400 samples (25.0 ms)
	     frame shift =  160 samples (10.0 ms)
	    pre-emphasis = 0.97
	    # filterbank = 24
	   cepst. lifter = 22
	      raw energy = False
	energy normalize = False
	    delta window = 2 frames (20.0 ms) around
	     hi freq cut = OFF
	     lo freq cut = OFF
	 zero mean frame = ON
	       use power = OFF
	             CVN = OFF
	            VTLN = OFF
    spectral subtraction = off
  cepstral normalization = sentence CMN
	 base setup from = Julius defaults

------------------------------------------------------------
Acoustic Model(s)

[AM00 "_default"]

 HMM Info:
    7946 models, 3131 states, 3131 mpdfs, 8256 Gaussians are defined
	      model type = has tied-mixture, context dependency handling ON
      training parameter = MFCC_E_N_D_Z
	   vector length = 25
	number of stream = 1
	     stream info = [0-24]
	cov. matrix type = DIAGC
	   duration type = NULLD
	    codebook num = 129
       max codebook size = 64
	max mixture size = 64 Gaussians
     max length of model = 5 states
     logical base phones = 43
       model skip trans. = not exist, no multi-path handling

 AM Parameters:
        Gaussian pruning = beam  (-gprune)
  top N mixtures to calc = 2 / 64  (-tmix)
    short pause HMM name = "sp" specified, "sp" applied (physical)  (-sp)
  cross-word CD on pass1 = handle by approx. (use 3-best of same LC)

------------------------------------------------------------
Language Model(s)

[LM00 "_default"] type=n-gram

 N-gram info:
	            spec = 3-gram, backward (right-to-left)
	        OOV word = <UNK>(id=0)
	    wordset size = 60437
	  1-gram entries =      60437  (  0.5 MB)
	  2-gram entries =    1294013  ( 16.3 MB) (46% are valid contexts)
	  3-gram entries =    2305375  ( 21.6 MB)
	LR 2-gram entries=    1294013  (  5.2 MB)
	           pass1 = given additional forward 2-gram

 Vocabulary Info:
        vocabulary size  = 60250 words, 381249 models
        average word len = 6.3 models, 19.0 states
       maximum state num = 180 nodes per word
       transparent words = not exist
       words under class = not exist

 Parameters:
	(-silhead)head sil word = 1: "<s> @0.000000 [] silB(silB)"
	(-siltail)tail sil word = 0: "</s> @0.000000 [] silE(silE)"

------------------------------------------------------------
Recognizer(s)

[SR00 "_default"]  AM00 "_default"  +  LM00 "_default"

 Lexicon tree:
	 total node num = 483155
	  root node num =    607
	(148 hi-freq. words are separated from tree lexicon)
	  leaf node num =  60250
	 fact. node num =  60250

 Inter-word N-gram cache: 
	root node to be cached = 193 / 606 (isolated only)
	word ends to be cached = 60437 (all)
	  max. allocation size = 46MB
	(-lmp)  pass1 LM weight = 8.0  ins. penalty = -2.0
	(-lmp2) pass2 LM weight = 8.0  ins. penalty = -2.0
	(-transp)trans. penalty = +0.0 per word
	(-cmalpha)CM alpha coef = 0.050000

 Search parameters: 
	    multi-path handling = no
	(-b) trellis beam width = 600 (-1 or not specified - guessed)
	(-bs)score pruning thres= disabled
	(-n)search candidate num= 5
	(-s)  search stack size = 500
	(-m)    search overflow = after 5000 hypothesis poped
	        2nd pass method = searching sentence, generating N-best
	(-b2)  pass2 beam width = 30
	(-lookuprange)lookup range= 5  (tm-5 <= t <tm+5)
	(-sb)2nd scan beamthres = 80.0 (in logscore)
	(-n)        search till = 5 candidates found
	(-output)    and output = 1 candidates out of above
	 IWCD handling:
	   1st pass: approximation (use 3-best of same LC)
	   2nd pass: loose (apply when hypo. is popped and scanned)
	 factoring score: 1-gram prob. (statically assigned beforehand)
	progressive output on 1st pass
	short pause segmentation = off
	        progout interval = 300 msec
	fall back on search fail = off, returns search failure

------------------------------------------------------------
Decoding algorithm:

	1st pass input processing = buffered, batch
	1st pass method = 1-best approx. generating indexed trellis
	output word confidence measure based on search-time scores

------------------------------------------------------------
FrontEnd:

 Input stream:
	             input type = waveform
	           input source = standard input
	          sampling freq. = 16000 Hz required
	         threaded A/D-in = supported, off
	   zero frames stripping = off
	         silence cutting = off
	    long-term DC removal = off
	    long-term DC removal = off
	    level scaling factor = 1.00 (disabled)
	      reject short input = < 800 msec
	      reject  long input = off

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

Stat: adin_stdin: reading wavedata from stdin...
STAT: 971620 samples (60.73 sec.)
STAT: ### speech analysis (waveform -> MFCC)
pass1_best:  。 真冬 画面 の 間 の 長き です 。 だけど 多く の 部屋 の
 まで も 今夜 は 雪 の スモール ところ が あり そう です 。 ん ! ?
 の 感じ が 何 月 で 、 帰路 は 北海道 室蘭 や 箱根 初 と なり まし た
 が 、 北海道 の 日本海 側 で は 満足 に 気がつい て ない 。 た 方 前
 前後 次元 〇 積雪 は 、 ほぼ 二 年 生まれ 十 二 全 地 など の 中 に
 。 、 この 後 感じ は 本屋 で 確定 ゆっくり と 何 か し ます ! ? 等
 を 十 五 分 も 雨 が 次第に 雪 に 変わり 、 夕方 以降 は 平穏 で も
 雪 の スモール どころ が あり そう です ! ? 北日本 で は 朝 五 中心
pass1_best:  。 真冬 画面 の 間 の 長き です 。 だけど 多く の 部屋 まで も 今夜 は 雪 の スモール ところ が あり そう です 。 北日本 重く なる の 感じ が 何 月 で 、 帰路 は 北海道 室蘭 や 箱根 初 と なり まし た が 、 北海道 の 日本海 側 で は 満足 に 気がつい て ない 。 た 方 前後 次元 〇 積雪 は 、 ほぼ 二 年 生まれ 十 二 全 地 など が あり ます 。 、 この 後 感じ は 本屋 で 確定 ゆっくり と 何 か し ます ! ? 等 を 十 五 分 も 雨 が 次第に 雪 に 変わり 、 夕方 以降 は 平穏 で も 雪 の スモール どころ が あり そう です ! ? 北日本 で は 朝 五 中心 に 論文 の 凍結 に 注意 が 必要 です 。 
sentence1:  。 真冬 画面 同館 の マガジン です 。 だって 、 多く の ゲーム で も 今夜 は 雪 の 住む ところ が あり そう です 。 、 北日本 重く なる の 感じ が 何 月 で 、 疲労 は 北海道 室蘭 や 函館 発 と なり まし た が な 、 北海道 の 日本海 側 で は 満足 に 雪 が 体 で 、 卵 前後 次元 材 の 積雪 は 、 ほぼ 二 年 生まれ 十 年 前 時 など と なり ます 。 、 この 党 幹事 は 今夜 メーカー で ゆっくりと なんか し ます 。 、 東北 十 号 で も 画面 が 次第に 雪 に 変わり 、 、 夕方 以降 は 平野 部 で も 雪 の 積もる どころ が 理想 です 。 、 北日本 で は サーバ を 中心 に ログ の 凍結 に 注意 が 必要 です 。 

Error: adin_stdin: stdin reached EOF
reached end of input on stdin


うーん、ビミョー、なのか、イケてる、のか。試行錯誤が必要に見える。