/n-grams-probabilities

(N+1)-Gram Probabilities in English and Russian languages

Primary LanguageTypeScriptMIT LicenseMIT

(N+1)-Gram Probabilities in English and Russian languages

What are N-gram probabilities?

Ever wondered what is the probability of character X to be placed after character Y in English or Russian (or bring your own) languages? No? Well I did, and built this simple script to calculate it.

Why do you need it? Perhaps you want to violate Apple's patents or just doing some linguistic exploration. Up to you.

How to run

It is extremely complicated, requires specialized knowledge, and I would not recommend anyone attempt it, unless you know what you are doing. Read the steps below with caution.

npm i
npm start

Place your .txt files with a single word on each line inside the input folder, and change the inputFileName to your file's name. Or touch nothing and enjoy the work I did for you.

Feel free to change upToNGram (starts from 1) to what ever depth you need (singles, bigrams, trigrams, infinity-grams-and-beyond).

Results

The script will do its magic and save the output in the output folder. Duh.

Contribution guide

Why would you?