NGRAMS(1p)
π ngrams β the ngram vibe, but make it a manpage π
okay bestie, so this is ngrams, a little Perl script living in the User Contributed Perl Documentation section (that's the 1p energy, iykyk). It computes ngram frequencies and produces tables straight to stdout. She's giving data, she's giving counts, she's giving tables. Periodt. β¨
πΈ SYNOPIS πΈ
(not me leaving the typo in, she's iconic like that π )
ngram [--version] [--help] [--n=3] [--normalize] [--type=TYPE]
[--orderby=ORD] [--onlyfirst=N] [input files]
π¦ DESCRIPTION π¦
This script produces n-grams tables of the input files to the standard output. That's the whole gig. You feed her files, she hands you tables on stdout. Slay.
Options:
--normalizeβ Prints normalized n-gram frequencies; i.e., the n-gram counts divided by the total number of n-grams of the same size. so instead of "this showed up 47 times" it's "this showed up this much out of everything of the same size" π--onlyfirst=NUMBERβ Prints only the first NUMBER n-grams for each n. See Text::Ngrams module.--limit=NUMBERβ Limit the total number of distinct n-grams (for efficiency reasons, the counts may not be correct at the end).
lowkey important bestie: with --limit, the counts may not be correct at the end. That's not a bug, that's just her being fast. Efficiency girlie things. π
--versionβ Prints version. quick lil identity check π--helpβ Prints help. when you're lost, she's got you π«Ά--n=NUMBERβ N-gram size, produces 3-grams by default. so like,--n=3is the default main character setting β¨--orderby=frequency|ngramβ The n-gram order. See Text::Ngrams module.--type=character|byte|word|utf8β Type of n-grams produces. See Text::Ngrams module.
π PREREQUISITES π
- Text::Ngrams
- Getopt::Long
gotta have the squad installed fr fr π
π SCRIPT CATEGORIES π
- Text::Statistics
β README β
N-gram analysis for various kinds of n-grams (character, words, bytes, utf8, and user-defined). Based on Text::Ngrams module.
so many flavors of n-gram, and she does all of them. versatile queen π
π SEE ALSO π
- Text::Ngrams module.
π COPYRIGHT π
Copyright 2003-2017 Vlado Keselj http://web.cs.dal.ca/~vlado
This module is provided "as is" without expressed or implied warranty. This is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The latest version can be found at http://web.cs.dal.ca/~vlado/srcperl/.
and that's the whole page bestie!! π«Ά this lil doc came to you courtesy of perl v5.34.0, dated 2022-06-28. thank you for coming to my TED talk, mwah πβ¨πΈ
π¦ where this page comes from
- debian bookworm: libtext-ngrams-perl 2.006-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtext-ngrams-perl 2.006-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtext-ngrams-perl 2.006-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtext-ngrams-perl 2.006-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtext-ngrams-perl 2.006-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms