LoginSignup
4
3

More than 3 years have passed since last update.

SRILM1.7.2を使ってみる

Last updated at Posted at 2018-08-28

インストールまでの手順

ダウンロード

ディレクトリの作成

$ mkdir srilm
$ mv srilm-1.7.2.tar.gz srilm/
$ cd srilm

解凍

$ tar -zxvf srilm-1.7.2.tar.gz

上記コマンドを入力すると下記のエラーが起こるときがある。
tar: Error exit delayed from previous errors.
その場合はMac標準のアーカイブユーティリティーを使って解凍する。

max-entropyモデルを作る場合

liblbfgsのインストール

$ curl -O https://github.com/chokkan/liblbfgs/archive/master.zip
$ unzip master.zip
$ cd master
$ ./autogen.sh
$ ./configure --enable-sse2
$ make
$ make install

SRILMの設定に追加 (macの場合)

$ echo HAVE_LIBLBFGS=1 >> common/Makefile.machine.macosx

コンパイル

$ make SRILM=$PWD

使ってみる

5-gramの言語モデルを作ってみる

$ ./ngram-count -order 5 -text ~/data/train.txt -lm 5gram.txt

パープレキシティをはかる

$ ./ngram -lm 5gram.txt -ppl ~/data/test.txt

Kneser Neyスムージングで5-gram言語モデルを作ってみる

$ ./ngram-count -order 5 -kndiscount -kndiscount5 -kn-counts-modified -text ~/data/train.txt -lm kn.txt

Maximum entropy 言語モデルを枝刈りしつつ作ってみる

$ ./ngram-count -maxent -prune 1e-7 -text ~/data/train.txt -lm maxent.txt
4
3
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
4
3