SLMBUILD(1)
π NAME π
okay so bestie, this is SLMBUILD(1), from the User Contributed Perl Documentation π
and itβs literally the page that teaches you how to build a language model from an idngram file. slmbuild generates a back-off smoothing language model from a given idngram_file. Generally, that idngram_file is created by ids2ngram. periodt β¨
π¦ SYNOPSIS π¦
slmbuild [option]... idngram_file...
πΈ DESCRIPTION πΈ
slmbuild generates a back-off smoothing language model from a given idngram file. Generally, the idngram_file is created by ids2ngram. thatβs the whole vibe π«Ά
π OPTIONS π
bestie, all the following options are mandatory. no cap, you need them. π
-n,--NMax Nβ1for unigram,2for bigram,3for trigram. any number not in the range1..3is not valid.-o, --out output-fileβ specify the outputxfileiname.-l, --logβ using-log(pr); by default,pris used directly.-w, --wordcount Nβ Lexican size, number of different words.-b, --brk id...β set the ids which should be treated as breaker.-e, --e id...β set the ids which should not be put into LM.-c, --cut c...βk-grams whosefreq <= c[k]are dropped.-d, --discount method, param...β the k-th-dparm specifies the discount method.
for a k-gram, the possible method/param values are:
GT,R,dis:GTdiscount forr <= R;ris the freq of an ngram. Linear discount for thoser > R, i.e.r'=r*dis.0 << dis < 1.0, for example0.999.ABS,[dis] : Absolute discountr'=r-dis. Anddisis optional.0 << dis < cut[k]+1.0, normallydis < 1.0.LIN,[dis] : Linear discountr'=r*dis. Anddisis optional.0 < dis < 1.0.
π₯ NOTE π₯
-n must be given before -c -b. And -c must give right number of cut-off, also -ds must appear exactly N times specifying the discounts for 1-gram, 2-gram..., respectively. π
BREAKER-IDs could be SentenceTokens or ParagraphTokens. Conceptually, these ids have no meaning when they appeared in the middle of n-gram.
EXCLUDE-IDs could be ambiguious-ids. Conceptually, n-grams which contain those ids are meaningless.
We can not erase ngrams according to BREAKER-IDS and EXCLUDE-IDs directly from IDNGRAM file, because some low-level information is still useful in it. so yeah, donβt try to skip that step π
π EXAMPLE π
the following example reads all.id3gram and writes trigram model all.slm.
At 1-gram level, use Good-Turing discount with cut-off 0, R=8, dis=0.9995. At 2-gram level, use Absolute discount with cut-off 3, dis auto-calc. At 3-gram level, use Absolute discount with cut-off 2, dis auto-calc. Word id 10,11,12 are breakers (sentence/para/paper breaker, etc). Exclude-ID is 9. Lexicon contains 200000 words. The result languagme model uses -log(pr).
slmbuild -l -n 3 -o all.slm -w 200000 -c 0,3,2 -d GT,8,0.9995 -d ABS -d ABS -b 10,11,12 -e 9 all.id3gram
π AUTHOR π
Originally written by Phill.Zhang <phill.zhang@sun.com>. Currently maintained by Kov.Chai <tchaikov@gmail.com>.
π¦ SEE ALSO π¦
and thatβs the page, bestie π itβs from perl v5.36.0, dated 2023-08-08 β iconic source/version energy, no notes β¨
π¦ where this page comes from
- ubuntu noble: sunpinyin-utils 3.0.0~rc2+ds1-5 Β· LGPL-2.1-only OR CDDL
- ubuntu questing: sunpinyin-utils 3.0.0~rc2+ds1-5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms