Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for GH 39 [aeio]nse$, GH 37 ying$ and (th|d)eist, GH 36 [gnst]ion$, misc #40

Merged
merged 7 commits into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ var EXPRESSION_MONOSYLLABIC_TWO = new RegExp(
'g[hn]',
'l[lv]',
'mm',
'n[cgn]',
'n[cgns]',
'r[cnsv]',
'squ',
's[cklst]',
Expand Down Expand Up @@ -106,6 +106,7 @@ var EXPRESSION_DOUBLE_SYLLABIC_ONE = new RegExp(
'ua',
'react?',
'orbed', // Cancel `'.[^aeiuoycgltdb]{2,}ed$',`
'shred', // Cancel `'.[^aeiuoycgltdb]{2,}ed$',`
'eings?',
'[aeiouy]sh?e[rs]'
].join('|') +
Expand All @@ -119,7 +120,8 @@ var EXPRESSION_DOUBLE_SYLLABIC_TWO = new RegExp(
'[^gq]ua[^auieo]',
'[aeiou]{3}',
'^(?:ia|mc|coa[dglx].)',
'^re(app|es|im|us)'
'^re(app|es|im|us)',
'(th|d)eist'
].join('|'),
'g'
)
Expand Down Expand Up @@ -180,7 +182,7 @@ var EXPRESSION_SINGLE = new RegExp(
'sides?',
'ports?',
'shires?',
'tion(?:ed|s)?'
'[gnst]ion(?:ed|s)?'
].join('|') +
')$'
].join('|'),
Expand Down Expand Up @@ -218,7 +220,7 @@ var EXPRESSION_DOUBLE = new RegExp(
'somer'
].join('|') +
')',
'(?:fully|berry|woman|women|edly)$'
'(?:fully|berry|woman|women|edly|union|((?:[bcdfghjklmnpqrstvwxz])|[aeiou])ye?ing)$'
].join('|'),
'g'
)
Expand Down
2 changes: 2 additions & 0 deletions problematic.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"adieu": 2,
"adobe": 3,
"anemone": 4,
"anyone": 3,
"apache": 3,
"aphrodite": 4,
"apostrophe": 4,
Expand Down Expand Up @@ -37,6 +38,7 @@
"karate": 3,
"machete": 3,
"maybe": 2,
"naive": 2,
"newlywed": 3,
"penelope": 4,
"people": 2,
Expand Down
196 changes: 196 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,202 @@ test('api', function(t) {
'GH-32 (awe)'
)

t.deepEqual(
[
'communion',
'contagion',
'decision',
'division',
'erosion',
'occasion',
'opinion',
'religion',
'reunion',
'bunion',
'fission',
'fusion',
'mission',
'nation',
'onion',
'passion',
'region',
'session',
'union',
'version',
'vision'
].map(syllable),
[3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
'GH-36 ([gnst]ion$)'
)

t.deepEqual(
[
'anybody',
'anymore',
'anyone',
'anyones',
'anyplace',
'anything',
'anythings',
'anytime',
'anyway',
'anyways',
'anywhere'
].map(syllable),
[4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
'GH-36 ^any'
)

t.deepEqual(
[
'anyone',
'everyone',
'alone',
'lonely',
'ozone',
'one',
'bone',
'phone'
].map(syllable),
[3, 3, 2, 2, 2, 1, 1, 1],
'GH-36 one$'
)

t.deepEqual(
[
'embodying',
'annoying',
'buoying',
'busying',
'envying',
'jurying',
'nosying',
'obeying',
'pitying',
'untying',
'braying',
'buying',
'cloying',
'crying',
'drying',
'dying',
'eying',
'eyeing',
'flying',
'lying',
'paying',
'plying',
'saying',
'spraying',
'toying',
'trying',
'tying',
'vying',
'ying'
].map(syllable),
[
4,
3,
3,
3,
3,
3,
3,
3,
3,
3,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
1
],
'GH-37 (ying$)'
)

t.deepEqual(
[
'shreds',
'shredded',
'shredder',
'shredders',
'shredding',
'shredless'
].map(syllable),
[1, 2, 2, 2, 2, 2],
'GH-37 shredless'
)

t.deepEqual(
[
'monotheist',
'monotheists',
'monotheistic',
'polytheist',
'polytheists',
'polytheistic',
'atheist',
'atheists',
'atheistic',
'pantheist',
'pantheists',
'pantheistic',
'deist',
'deists',
'deistic',
'theist',
'theists',
'theistic',
'heist'
].map(syllable),
[4, 4, 5, 4, 4, 5, 3, 3, 4, 3, 3, 4, 2, 2, 3, 2, 2, 3, 1],
'GH-37 (th|d)iest(s|ic)?)'
)

t.deepEqual(
[
'reminiscense',
'commonsense',
'innocense',
'recompense',
'condense',
'defense',
'dispense',
'expanse',
'expense',
'immense',
'intense',
'license',
'mouthrinse',
'nonsense',
'offense',
'pretense',
'response',
'suspense',
'cleanse',
'dense',
'rinse',
'sense',
'tense'
].map(syllable),
[4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1],
'GH-39 ([aeiouy]nse$)'
)

t.end()
})

Expand Down