UNPKG

@unglish/word-generator

Version:

A simple generator for creating unglish words.

132 lines (131 loc) 6.76 kB
export const sonority = { "highVowel": 7, "midVowel": 6, "lowVowel": 5, "glide": 4.5, "liquid": 4, "nasal": 3.5, "sibilant": 3.2, "voicedFricative": 3, "voicelessFricative": 2.5, "affricate": 2, "voicedStop": 1.5, "voicelessStop": 1, }; export const phonemes = [ // High Vowels { sound: "i:", type: "highVowel", tense: true, nucleus: 150, startWord: 10, midWord: 1, endWord: 1 }, { sound: "ɪ", type: "highVowel", tense: false, nucleus: 230, startWord: 1, midWord: 4, endWord: 0 }, // Mid Vowels { sound: "e", type: "midVowel", tense: false, nucleus: 140, startWord: 8, midWord: 2, endWord: 0 }, { sound: "ɛ", type: "midVowel", tense: false, nucleus: 280, startWord: 8, midWord: 2, endWord: 0 }, { sound: "ə", type: "midVowel", tense: true, nucleus: 800, startWord: 4, midWord: 8, endWord: 0.5 }, { sound: "ɜ", type: "midVowel", tense: true, nucleus: 50, startWord: 4, midWord: 2, endWord: 2 }, { sound: "ɚ", type: "midVowel", tense: true, nucleus: 90, startWord: 0, midWord: 2, endWord: 2 }, // Low Vowels { sound: "æ", type: "lowVowel", tense: false, nucleus: 220, startWord: 6, midWord: 6, endWord: 2 }, { sound: "ɑ", type: "lowVowel", tense: true, nucleus: 150, startWord: 6, midWord: 2, endWord: 2 }, { sound: "ɔ", type: "lowVowel", tense: true, nucleus: 130, startWord: 6, midWord: 2, endWord: 2 }, { sound: "o", type: "lowVowel", tense: true, nucleus: 100, startWord: 6, midWord: 2, endWord: 2 }, { sound: "ʊ", type: "lowVowel", tense: true, nucleus: 70, startWord: 4, midWord: 2, endWord: 2 }, { sound: "u", type: "lowVowel", tense: true, nucleus: 80, startWord: 8, midWord: 2, endWord: 6 }, { sound: "ʌ", type: "lowVowel", tense: false, nucleus: 180, startWord: 4, midWord: 2, endWord: 1 }, // Diphthongs (typically treated as mid or low vowels) { sound: "eɪ", type: "midVowel", tense: true, nucleus: 170, startWord: 6, midWord: 2, endWord: 6 }, { sound: "ɪə", type: "midVowel", tense: true, nucleus: 30, startWord: 4, midWord: 2, endWord: 4 }, { sound: "eə", type: "midVowel", tense: true, nucleus: 20, startWord: 4, midWord: 2, endWord: 4 }, { sound: "aɪ", type: "midVowel", tense: true, nucleus: 150, startWord: 6, midWord: 2, endWord: 6 }, { sound: "ʊə", type: "midVowel", tense: true, nucleus: 10, startWord: 6, midWord: 2, endWord: 6 }, { sound: "əʊ", type: "midVowel", tense: true, nucleus: 140, startWord: 6, midWord: 2, endWord: 6 }, { sound: "ɔɪ", type: "midVowel", tense: true, nucleus: 20, startWord: 4, midWord: 2, endWord: 4 }, { sound: "aʊ", type: "midVowel", tense: true, nucleus: 60, startWord: 6, midWord: 1, endWord: 6 }, // Tripthongs { sound: "aɪə", type: "lowVowel", tense: true, nucleus: 80, startWord: 3, midWord: 1, endWord: 3 }, { sound: "aʊə", type: "lowVowel", tense: true, nucleus: 60, startWord: 2, midWord: 1, endWord: 2 }, { sound: "eɪə", type: "midVowel", tense: true, nucleus: 50, startWord: 2, midWord: 1, endWord: 2 }, { sound: "ɔɪə", type: "midVowel", tense: true, nucleus: 40, startWord: 2, midWord: 0, endWord: 2 }, { sound: "əʊə", type: "midVowel", tense: true, nucleus: 30, startWord: 1, midWord: 2, endWord: 2 }, // Glides { sound: "j", type: "glide", onset: 10, coda: 20, startWord: 6, midWord: 2, endWord: 2 }, { sound: "w", type: "glide", onset: 120, coda: 10, startWord: 6, midWord: 2, endWord: 2 }, // Liquids { sound: "l", type: "liquid", onset: 200, coda: 200, startWord: 8, midWord: 2, endWord: 8 }, { sound: "r", type: "liquid", onset: 500, coda: 100, startWord: 8, midWord: 2, endWord: 8 }, // Nasals { sound: "m", type: "nasal", onset: 100, coda: 176, startWord: 6, midWord: 2, endWord: 8 }, { sound: "n", type: "nasal", onset: 350, coda: 350, startWord: 8, midWord: 2, endWord: 10 }, { sound: "ŋ", type: "nasal", onset: 0, coda: 70, startWord: 0, midWord: 2, endWord: 4 }, // Voiceless Fricatives { sound: "f", type: "voicelessFricative", onset: 100, coda: 35, startWord: 6, midWord: 2, endWord: 4 }, { sound: "θ", type: "voicelessFricative", onset: 50, coda: 50, startWord: 4, midWord: 2, endWord: 4 }, { sound: "s", type: "sibilant", onset: 400, coda: 175, startWord: 10, midWord: 2, endWord: 10 }, { sound: "ʃ", type: "sibilant", onset: 35, coda: 5, startWord: 4, midWord: 2, endWord: 2 }, { sound: "h", type: "voicelessFricative", onset: 120, coda: 0, startWord: 4, midWord: 2, endWord: 0 }, // Voiced Fricatives { sound: "v", type: "voicedFricative", onset: 85, coda: 20, startWord: 6, midWord: 2, endWord: 2 }, { sound: "ð", type: "voicedFricative", onset: 250, coda: 50, startWord: 6, midWord: 2, endWord: 4 }, { sound: "z", type: "sibilant", onset: 5, coda: 50, startWord: 4, midWord: 4, endWord: 4 }, { sound: "ʒ", type: "sibilant", onset: 5, coda: 3, startWord: 0, midWord: 6, endWord: 0 }, // Affricates { sound: "tʃ", type: "affricate", onset: 40, coda: 30, startWord: 4, midWord: 2, endWord: 2 }, { sound: "dʒ", type: "affricate", onset: 30, coda: 20, startWord: 4, midWord: 2, endWord: 2 }, // Voiceless Stops { sound: "p", type: "voicelessStop", onset: 165, coda: 50, startWord: 8, midWord: 2, endWord: 6 }, { sound: "t", type: "voicelessStop", onset: 350, coda: 350, startWord: 10, midWord: 2, endWord: 10 }, { sound: "k", type: "voicelessStop", onset: 220, coda: 100, startWord: 8, midWord: 2, endWord: 6 }, // Voiced Stops { sound: "b", type: "voicedStop", onset: 160, coda: 20, startWord: 6, midWord: 4, endWord: 4 }, { sound: "d", type: "voicedStop", onset: 210, coda: 210, startWord: 8, midWord: 4, endWord: 8 }, { sound: "g", type: "voicedStop", onset: 150, coda: 20, startWord: 6, midWord: 4, endWord: 4 }, // go ]; export const invalidBoundaryClusters = [ /rɜ/, /ɜr/, /ʃh/, /sʃ/, /ʒs/, ]; const invalidGeneralClusters = [ ...invalidBoundaryClusters, /kf/, /t[θðdn]/, /mw/, /k[nb]/, /d[tp]/, /pb/, /ʒr/, /^.*.?[ðŋhʃ].?.*$/, // invalid in any position of a string at least 2 characters long ]; export const invalidOnsetClusters = [ ...invalidGeneralClusters, /^[wrlvznmjhʃ].{1,2}/, /^.[wzgdbθhvʃsf]/, /[^s]k/, /^[dtθð](?!r)./, /^[kgpfb](?![rl])./, /^sr/, ]; export const invalidCodaClusters = [ ...invalidGeneralClusters, /vsk$/, /.?[kθð](?![szd])$/, /lv(?![zd])$/, /[](?![zdt])/, /m[tvg]/, /[vlstd]g/, /.*sp/, /tp/, /pk/, /np/, /nb/, /nzt/, /lnd/, /dʒt/, /.*.?v$/, /.*.?mp$/, /.*.?b$/, /.*?[jw]$/, /[szʒ]l$/, /[wðf]r$/, /[θðf]rl$/, ];