<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>
npm install --save spellaphone
And code:
const spellaPhone = require('spellaphone')
const words = spellaPhone('8004654329')
console.log(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.
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.