ngrams(3pm)

πŸ“¦
version 2.006 Β· 2 versions
  • 2.006 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 2.006 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– ngrams πŸ’–

okay bestie, welcome to the ngrams(3pm) page β€” it's one of the user-contributed Perl docs, and it's giving "small script, big brain" energy fr fr. Let's get into it ✨


🌸 NAME 🌸

ngrams β€” Compute the ngram frequencies and produce tables to the stdout. yes, stdout, that's the whole vibe πŸ’…


πŸŽ€ SYNOPIS πŸŽ€

(bestie the heading typo is canon, we don't fix it, we respect it πŸ™ˆ)
  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 it, that's the job, and it does it iconically πŸ‘‘

πŸ“ 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 raw counts you get the ✨proportions✨
  • --onlyfirst=NUMBER β€” Prints only the first NUMBER n-grams for each n. See Text::Ngrams module. when you want a lil taste, not the whole meal 🍽️
  • --limit=NUMBER β€” Limit the total number of distinct n-grams (for efficiency reasons, the counts may not be correct at the end). heads up bestie β€” efficiency mode means the numbers might be lowkey off at the finish line, that's a documented thing, not a bug you found πŸ’€
  • --version β€” Prints version. short king behavior, love that
  • --help β€” Prints help. the classic, the legend 🫢
  • --n=NUMBER β€” N-gram size, produces 3-grams by default. 3 is the default, so if you say nothing you're getting trigrams, no cap
  • --orderby=frequency|ngram β€” The n-gram order. See Text::Ngrams module. pick your sorting slay: frequency or ngram
  • --type=character|byte|word|utf8 β€” Type of n-grams produces. See Text::Ngrams module. your options are character, byte, word, or utf8 β€” pick your fighter 🌈

πŸ¦‹ PREREQUISITES πŸ¦‹

  • Text::Ngrams
  • Getopt::Long

gotta have both, bestie, no shortcuts πŸ’–


🌈 SCRIPT CATEGORIES 🌈

Text::Statistics

that's the category it lives under, cute right ✨


πŸ“– README πŸ“–

N-gram analysis for various kinds of n-grams (character, words, bytes, utf8, and user-defined). Based on Text::Ngrams module. user-defined?? obsessed. the range. the versatility. πŸ‘‘


πŸ”₯ SEE ALSO πŸ”₯

Text::Ngrams module.

go read it, it's where all the real details live iykyk πŸ’œ


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/.

real talk though: "as is", no warranty, expressed or implied β€” that's the actual legal vibe, don't come for anybody if it goes sideways πŸ™ˆ

and that's the whole page bestie!! this one's brought to you by perl v5.34.0, dated 2022-06-28 β€” shoutout to the version and the date, they ate πŸ’…βœ¨ mwah, go compute some n-grams πŸ¦‹πŸ’–

πŸ“¦ where this page comes from