@hello-worlds/Tongues
Automatically generate a limited conlang, and operate on it.
Example
The language of Páikia-páa-Puip
Names
Usage
import { Language } from "@hello-worlds/tongues"
// generates a conlang, selecting a list of phonemse, assigning a sylable structure, and generating an orthography
const conlang = new Langauge()
// generates a valid syllable using the conlang's syllable structure
// such as "CVC" or "C?VC"
// See Syllable Structures below for more details
const syllable = conlang.makeSyllable()
console.log(conlang.spell(syllable)) // spells out the syllable using the conlang's orthography.
// compose a morpeme based on a number of valid syllables, adds to the conlang's morpheme lexicon
const morpheme = conlang.makeMorpheme()
// compose a word based on a number of valid morphemes, adds to the conlang's word lexicon
const word = conlang.makeWord("Banana")
// generates a name using makeWord, but with the possible addition of genetives or definite articles
// such as The Kingdom of Something
const characterName = conlang.makeName()
Syllable Structures
Syllable structures are how syllables are composed, which is an atomic component of morphemes. A syllable can have an onset, a nucleus, and a coda.
In most cases, the nucleus will be a vowel, and the onset and coda may be optional.
We can represent the syllable structure of a language as a series of characters, where each character represents a phoneme class (Consonant, Vowel, or further subdivisions such as Fricative, Liquid, Sonorant).
A question mark may follow optional phonemes.
The following are the included syllable structures. Note that the selection is random and will not be sampled based on the observed distribution of syllable structures in the real world.
export const syllableStructures = [
"CVC",
"C?CVC?C",
"C?C?VC?C?C?C?", // This syllable structure represents English, which has a crazy amount of variety.
"CVV?C",
"CVVC?",
"CVC?",
"CV",
"VC",
"CVF",
"C?VC",
"CVF?",
"CL?VC",
"CL?VF",
"S?CVC",
"S?CVF",
"S?CVC?",
"C?VF",
"C?VC?",
"C?VF?",
"C?L?VC",
"VC",
"CVL?C?",
"C?VL?C",
"C?VLC?",
"C?VLC?C?",
]
It's possible to choose your own syllable structure.
const myConlang = new Langauge()
// this will look goofy!
myColang.structure = "V?C"
Orhographies
Orthographies are how phonemes are rendered into text, but here it's bassically used as the conlang's romanization. There's many ways to write a single phoneme, and these impart a great deal of flavor to a text. You can chose the orthography seperately for consonants and vowels, but they'll be generated automatically in the constructor.
const myConlang = new Langauge();
myColang.consonantOrthography = {
name: "French",
orth: {
ʃ: "ch",
ʒ: "j",
ʧ: "tch",
ʤ: "dj",
x: "kh",
},
},
// An example orthography set shipped with this library. You may provide your own :)
export const consonantOrthoSets = [
{
name: "Default",
orth: {},
},
{
name: "Slavic",
orth: {
ʃ: "š",
ʒ: "ž",
ʧ: "č",
ʤ: "ǧ",
j: "j",
},
},
{
name: "German",
orth: {
ʃ: "sch",
ʒ: "zh",
ʧ: "tsch",
ʤ: "dz",
j: "j",
x: "ch",
},
},
{
name: "French",
orth: {
ʃ: "ch",
ʒ: "j",
ʧ: "tch",
ʤ: "dj",
x: "kh",
},
},
{
name: "Chinese (pinyin)",
orth: {
ʃ: "x",
ʧ: "q",
ʤ: "j",
},
},
]
Future ideas
Right now it's a simplistic model mostly useful for generating names. In the future, I'd like to add:
- better represent phoneme class restrictions in syllable structures.
- loan word adaption from another
Language
- transform a load word, such asChristmas
turns intoKalikimaka
(English to Hawaiian) - deterministically simulate
Language
drift - expand phonetic inventory
- create simple grammar rules