ngrams command not found

In this troubleshooting guide we learn how to fix ngrams command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

ngrams: command not found

or when using sudo you get the following error message

sudo: ngrams: command not found

Solutions to ngrams: command not found

How To Fix ngrams: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu ngrams is provided by libtext-ngrams-perl package.

libtext-ngrams-perl is:

Text::Ngrams is a module for flexible N-gram analysis of text. It supports character n-grams, word n-grams, and many more types of n-grams. It allows a user to manually feed a sequence of tokens, has automatic recognition and feed of tokens, and the way they are combined in an n-gram. It can also be used from the command line through the script ngrams.pl provided with the package.

To fix this problem, we can install more using the command below.

sudo apt-get -y install libtext-ngrams-perl

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install libtext-ngrams-perl.

sudo apt -y install libtext-ngrams-perl

Or if you have aptitude installed you can use the following command.

sudo aptitude install libtext-ngrams-perl

Summary

In this tutorial we learn how to fix ngrams command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.