1.0.4 • Published 5 years ago

voweler v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

voweler

goal: insert vowels in text that has no vowels (unless word starts with vowel)

idea:

  • precompute double metaphones for dictionary words
  • precompute voweless versions of dictionary words
  • at runtime, compute double metaphone for input word
  • if double metaphone is null (e.g. metaphone('w')), get metaphone for word + 'a'
  • filter dictionary by words whose voweless, sorted representation match input word (sorted)
  • compute a score defined as the mean levenshtein distance between primary and secondary metaphones for each dictionary word against input word
    • that is, for each dictionary word's metaphones [dp, ds], and the input word's metaphones [ip, is], compute (leven(dp, ip) + leven(ds, is)) / 2
  • filter the wordlist by smallest possible score and grab the top

using a wordlist that is sorted by usage and is relatively small (20k words) shows best results.

status: isn't horrible

use

$ npx voweler hppy brthdy
happy birthday

or import to your project (why?)

const voweler = require('voweler')

const vowelized = voweler('a sntnc wtht vwls')
// a contains without wolves
// -_- -_- -_- -_- -_- -_-

License

MIT

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago