Example Programs with ETS

The examples in this section have to do with trigram generation. This is a nice “show-off” program that demonstrates the power of the ETS tables.

Our goal is to write a heuristic program that tries to predict whether a given string is an English word.

To predict whether a random sequence of letters is an English word, we’ll analyze which trigrams occur in the word. A trigram is a sequence of three letters. Now, not all sequences of three letters can occur in a valid English word. For example, there are no English words where the three-letter combinations akj and rwb occur. So, to test whether a string might be an English word, all we have to do is test all sequences of three consecutive letters in the string against ...

Get Programming Erlang, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.