Description

Implementation of n-grams: https://github.com/thejohnbackes/storywriter-core

Presentation: https://thejohnbackes.github.io/techtalk/#/0/2

Presentation notes in markdown: https://github.com/thejohnbackes/techtalk#with-n-g...

The Facebook Live link: https://www.facebook.com/thejohnbackes/posts/10102...

One fish, two fish, red fish....

The first President of the United States was...

Horton hears a...

The human mind knows how to process text inputs and come up with likely results. But how do you help a computer do the same thing? Want to take a guess?

The answer is Natural Language Processing, or NLP. NLP is a huge subject (see: https://github.com/thejohnbackes/techtalk#natural-language-processing), but a key tool for NLP is what I talk about in this demonstration. The n-gram.

What is an N-gram?

An n-gram is a Language Modeling Tool that can be easily processed by computers.

N = 1 : "Unigram (or, you know, a word)" ie: "The"

N = 2 : "Bigram" ie: "The Cat"

N = 3 : "Trigram", etc. ie: "The Cat sat"

N = 4 : "Four-gram", "Five-Gram", etc. ie: "The Cat sat on the hat"

Here's a Formal Definition for an n-gram:

In the fields of computational linguistics and probability, an n-gram is:

a contiguous sequence of n items from a given sequence of text or speech.

The items can be phonemes, syllables, letters, words or base pairs according to the application.

The n-grams typically are collected from a text or speech corpus.

Here are some more n-gram example: https://github.com/thejohnbackes/techtalk#n-grams-...

To apply an n-gram, we use the Markov Model of language structure: https://github.com/thejohnbackes/techtalk#the-mark...

Here I provide an example to help you understand Markov Models with everybody's old favorite, Green Eggs and Ham: https://github.com/thejohnbackes/techtalk#green-eg...

Can I use PSQL for bigrams and trigrams and n-grams? Can I use Sequelize for n-grams?

How do I generate an n-gram using Sequelize and PSQL? Here's an example:

https://github.com/thejohnbackes/techtalk#sequeliz...

Finally, here is a great list of resources for n-grams: https://github.com/thejohnbackes/techtalk#resource...

Team Members
  • John Backes

Learn more about our fullstack JavaScript curriculum

Learn More