IDS2NGRAM(1)
okay so bestie, welcome to IDS2NGRAM(1) β yes it's the User Contributed Perl Documentation page β and we are about to make ids2ngram generate n-gram data files from ids files. it's giving binary-id-stream main character energy. π«Άβ¨
πΈ NAME πΈ
ids2ngram β generate n-gram data file from ids file. literally that's the whole name line, and yes bestie it ate. π
β¨ SYNOPSIS β¨
ids2ngram [option]... ids_file...
π¦ DESCRIPTION π¦
okay so ids2ngram generates an idngram file. that file is a sorted [id1,..,idN,freq] array, and it comes from binary id stream files. the id stream files are always generated by mmseg or slmseg β those are the sources, periodt. π
basically, it finds all occurrence of n-words tuples (i.e. the tuple of (id1,..,idN)), then sorts these tuples by the lexicographic order of the ids make up the tuples, then writes them to specified output file. no cap, that's the whole vibe. π
π INPUT π
the input file is presented as a binary id stream, which looks like:
[id0,...,idX]
π OPTIONS π
all the following options are mandatory. not "maybe", not "if you feel like it" β mandatory, bestie. π
-n,--NMax Nβ generates N-gram result.ids2ngramdoes only support uni-gram, bi-gram, and trigram, so any number not in the range of1..3is not valid. so like... keep it1,2, or3. π-s,--swap swap-fileβ specify the temporary intermediate file. π-o,--out output-fileβ specify the resultidngramfile, e.g. the array of[id1, ..., idN, freq]. π-p,--para Nβ specify the maximum n-gram items per paragraph.ids2ngramwrites to the temporary file on a per-paragraph basis. every time it writes a paragraph out, it frees the corresponding memory allocated for it. when your computer system permits, a higherNis suggested. this can speed up the processing speed because of less I/O. highkey iconic optimization behavior. π₯
π EXAMPLE π
following example will use three input idstream file idsfile[1,2,3] to generate the idngram file all.id3gram. each para (internal map size or hash size) would be 1024000, using swap file for temp result. all temp para result would eventually be merged to got the final result. (yes "got" is what the page says, bestie, we keep the details.) π
ids2ngram -n 3 -s /tmp/swap -o all.id3gram -p 1024000 idsfile1 idsfile2
idsfile3
π«Ά AUTHOR π«Ά
originally written by Phill.Zhang <phill.zhang@sun.com>. currently maintained by Kov.Chai <tchaikov@gmail.com>. shoutout to both, fr fr. π
π§ SEE ALSO π§
mmseg(1), slmseg(1), slmbuild (1). go read those next, bestie β iykyk. πΈ
mwah π β this page comes from perl v5.36.0, dated 2023-08-08, and yes it's the IDS2NGRAM(1) page. slay and bye. β¨
π¦ 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