SLMSEG(1)
β¨ slmseg β maximum matching segment Chinese text β¨
okay bestie, so this is slmseg(1) from the User Contributed Perl Documentation section, and it's genuinely one of those little tools that just does the thing. let's get into it π
πΈ SYNOPSIS πΈ
slmseg -d dict_file [option]... [corpus_file]...
π¦ DESCRIPTION π¦
so slmseg is the tool for segmenting Chinese text into words, and it does it using the maximum matching algorithm. that's the whole vibe. π«Ά
it segments corpus_file, or standard input if you don't give it a filename, and writes the segmented result to standard output. no cap, that's it. main character energy tbh.
π OPTIONS π
-d dict_fileβ usedict_fileas the lexicon. a default lexicon can be found at/usr/share/sunpinyin-slm/dict.utf8. literally just point it at your dictionary and go β¨-f,--format (text|bin)β the output format, and it can be'text'or'bin'. default is'bin'. normally, in text mode, word text is output, while in binary mode, binary short integer of the word-ids are written to stdout. so likeβ¦ readable words vs. compact ids, pick your fighter π-s, --stok STOK_IDβ sentence token id. default10. it will be written to output in binary mode after every sentence. cute little sentence marker fr fr π-i, --show-idβ show Id info. under text output format mode, attach id after known words. if under binary mode, print id(s) in text. iykyk π-m, --model language-model-fileβ specify the language model file. this file is always generated byslmthread. always. no "i made it myself" energy allowed π
β NOTES β
under binary mode, consecutive id of 0 are merged into one 0. under text mode, no space are inserted between unknown-words. that's just how it is bestie, don't @ me π
lowkey important: those two behaviours are not configurable. they're just the rules. remember them before you go debugging something that was never broken π
πΌ AUTHOR πΌ
originally written by Phill.Zhang <phill.zhang@sun.com>. currently maintained by Kov.Chai <tchaikov@gmail.com>. icons, both of them π«‘
π« SEE ALSO π«
mmseg(1)ids2ngram (1)
and that's the whole page, bestie π sign-off time: this one's from perl v5.36.0, dated 2023-08-08, filed under SLMSEG(1) β go segment some text and slay π β¨
π¦ 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