Skip to content

allenluce/spellaphone

Repository files navigation

SpellaPhone

Travis CI Build Status NPM version

Find out what your number spells!

Use in the browser!

A web page goes here
<script src="https://cdn.jsdelivr.net/gh/allenluce/spellaphone/spellaphone.js"></script>
<script>
  const spellaPhone = require('spellaphone')
  const words = spellaPhone('7976638377')
  console.log(words)
</script>

Use on the command line!

npm install -g spellaphone

Spell a bunch 'o numbers:

npm install -g spellaphone

Use with Node.js! Install:

npm install --save spellaphone

And code:

const spellaPhone = require('spellaphone')
const words = spellaPhone('8004654329')
console.log(words)

What are the words?

The words come from the SCOWL corpus of English and American words. The actual files used are the SCOWL final ones of SCOWL size 70. Single letter "words" (except for "a") have been removed as has any word containing a q or a z, as those aren't on my phone's dial.

Technical details

The 1970's Aho-Corasick algorithm is used to perform a simultaneous search of over 100,000 dictionary words and find matches for your phone number. Alfred Aho and Margaret Corasick's groundbreaking work resulted in a speedup of four or five times over the algorithms of the day and hundreds of times over a simple dictionary search. The Spellaphone algorithm is an adaptation of the Aho-Corsick algorithm that finds words by searching with numbers.