Take into account impossible articulations when generating consonants and change a few things.

This commit is contained in:
Feufochmar 2018-06-23 01:03:45 +02:00
parent 753d253f1b
commit 8cee7b046a
1 changed files with 16 additions and 12 deletions

View File

@ -276,20 +276,21 @@ class Consonant:
"""Consonant representation"""
# Simplified model
# '%' means impossible articulation
matrixPhonemes = [
["m", "ɱ", "n", "ɳ", "ɲ", "ŋ", "ɴ", "ɴ"], # nasal
["m", "ɱ", "n", "ɳ", "ɲ", "ŋ", "ɴ", "%"], # nasal
["p", "", "t", "ʈ", "c", "k", "q", "ʔ"], # stop voiceless
["b", "", "d", "ɖ", "ɟ", "ɡ", "ɢ", "ɢ"], # stop voiced
["ɓ", "ɓ̪", "ɗ", "", "ʄ", "ɠ", "ʛ", "ʛ"], # stop implosive
["b", "", "d", "ɖ", "ɟ", "ɡ", "ɢ", "%"], # stop voiced
["ɓ", "ɓ̪", "ɗ", "", "ʄ", "ɠ", "ʛ", "%"], # stop implosive
["pf", "", "ts", "ʈʂ", "", "kx", "", "ʔh"], # affricate voiceless
["bv", "", "dz", "ɖʐ", "", "ɡɣ", "ɢʁ", "ʡʕ" ], # affricate voiced
["f", "θ", "s", "ʂ", "ʃ", "x", "χ", "h"], # fricative voiceless
["v", "ð", "z", "ʐ", "ʒ", "ɣ", "ʁ", "ɦ"], # fricative voiced
["β", "ʋ", "ɹ", "ɻ", "j", "w", "ʁ", "ʕ"], # approximant
["", "", "ɾ", "ɽ", "ɾ", "ɢ̆", "ɢ̆", "ʡ̮"], # tap/flap
["ʙ", "ʙ̪", "r", "ɽr", "r", "ʀ", "ʀ", "ʢ"], # trill
["l", "l", "l", "ɭ", "ʎ", "ʟ", "ʟ̠", "ʟ̠"], # lateral
["ʘ", "ǀ", "ǃ", "ǁ", "ǂ", "ʞ", "ʞ", "ʞ"], # click
["", "", "ɾ", "ɽ", "%", "%", "ɢ̆", "ʡ̮"], # tap/flap
["ʙ", "ʙ̪", "r", "ɽr", "%", "%", "ʀ", "ʢ"], # trill
["%", "l", "l", "ɭ", "ʎ", "ʟ", "ʟ̠", "%"], # lateral
["ʘ", "ǀ", "ǃ", "ǁ", "ǂ", "ʞ", "%", "%"], # click
]
# left>right: place of articulation:
@ -371,6 +372,9 @@ class Consonant:
def getDescription(self):
return "#consonant"
def isPossible(manner, place):
return '%' != Consonant.matrixPhonemes[manner][place]
# Has retroflex consonants ?
retroflexDistribution = phonagen.Distribution()
retroflexDistribution.addTo(True, 5)
@ -399,7 +403,7 @@ voicedDistribution.addTo(False, 5)
# Has click ?
clickDistribution = phonagen.Distribution()
clickDistribution.addTo(True, 1)
clickDistribution.addTo(False, 29)
clickDistribution.addTo(False, 69)
# Rhotic realisation
rhoticRealisationDistribution = phonagen.Distribution()
@ -466,7 +470,7 @@ def generateConsonantSet():
for pl in places:
for mn in manners:
# there is a small chance that a phoneme not on the nominal place will be skipped
if (pl == nominalPlace) or (random.randrange(8) != 0):
if Consonant.isPossible(mn, pl) and ((pl == nominalPlace) or (random.randrange(8) != 0)):
cons = Consonant(mn, pl)
# there may be some modifications on the manner or place depending on how contrastive are the consonants
if (not hasSeparateAffricates) and (pl == Consonant.palatal) and (random.randrange(10) < 8):
@ -524,17 +528,17 @@ def addSimpleLatinTranscription(transcriptions, phonemeList):
["", "", "r", "ř", "r", "gy", "gr", "hg"], # tap/flap
["br", "br", "rr", "řr", "ry", "ŕr", "ŕr", ""], # trill
["l", "l", "l", "ľ", "ly", "ĺl", "ĺl", "ĺl"], # lateral
["ʘ", "ǀ", "ǃ", "ǁ", "ǂ", "ʞ", "ʞ", "ʞ"], # click
["p*", "ṕ*", "t*", "ť*", "c*", "k*", "q*", "q*"], # click
]
nasalSign = random.choice(["\u0328", "\u0330", "n"]) # combining ogonek, combining tilde below, n
for ph in phonemeList:
tr = ""
if isinstance(ph, Vowel):
tr = vowelTranslationMatrix[ph.height][ph.backness]
if ph.isNasal:
tr = tr + nasalSign
if ph.isLong:
tr = tr + tr # Double
if ph.isNasal:
tr = tr + nasalSign
if isinstance(ph, Consonant):
tr = consonantTranslationMatrix[ph.manner][ph.place]
if ph.isAspirated: