def ParseSyll(s): # Assign -1.0 to immed. syllable dependents of PrWd if s.label() == 'Syll': v = -1 else: v = 0 return Mark('ParseSyll', v)
def StressFinal(t): # Assign -1.0 to o and +1.0 to x in final position s = t.right_sibling() if s is None and t.label() in ['x', 'o']: v = -1 if t.label() == 'o' else +1 else: v = 0 return Mark('StressInitial', v)
def NonFinality(t): # Assign -1.0 to x and +1.0 to o in final position s = t.right_sibling() if s is None and t.label() in ['x', 'o']: v = -1 if t.label() == 'x' else +1 else: v = 0 return Mark('NonFinality', v)
def AllFeetRight(s): # Assign -1.0 to each foot that is immed. followed by # an unfooted syllable if is_foot(s) and s.right_sibling() is not None \ and s.right_sibling().label() == 'Syll': v = -1 else: v = 0 return Mark('AllFeetRight', v, subnode='upper')
def Trochaic(s): if is_foot(s) and len(s) > 1: if re.search('StressSyll', s[0].label()): # left-headed Ft v = +1 else: v = -1 else: v = 0 return Mark('Trochaic', v, subnode='lower')
def NoMid(t): # Non-low vowels should be [+high] v = 0 x = t.olabel if re.search('[iu]', x): v = +1 elif re.search('[eo]', x): v = -1 return Mark('NoMid', v, subnode='high')
def AlternateR(t): # In the context x __ assign -1 to x and +1 to o, # o __ assign -1 to o and -1 to x s = t.left_sibling() if s is not None and t.label() in ['x', 'o']: v = -1 if t.label() == s.label() else +1 else: v = 0 return Mark('AlternateR', v)
def Iambic(s): if is_foot(s) and len(s) > 1: if re.search('StressSyll', s[1].label()): # right-headed Ft v = +1 else: v = -1 else: v = 0 return Mark('Iambic', v, subnode='lower')
def AlternateL(t): # In the context __ x assign -1 to x and +1 to o # __ o assign -1 to o and +1 to x s = t.right_sibling() if s is not None and t.label() in ['x', 'o']: v = -1 if t.label() == s.label() else +1 else: v = 0 return Mark('AlternateL', v)
def NoLapseR(t): # Assign -1.0 to o and +1.0 to x in the context / o __ s = t.left_sibling() if s is not None and s.label == 'o': if t.label == 'o': v = -1 elif t.label == 'x': v = +1 return Mark('NoLapseR', v)
def FootBinarity(s): # Assign -1.0 to subminimal/supermaximal Feet if is_foot(s): if len(s) == 2: v = +1 else: v = -1 else: v = 0 return Mark('FootBinarity', v, subnode='lower')
def SpreadNasL(t): # Segments immediately preceded by span members must be dependents v = 0 x, succ = x, get_succ(t) if re.search('[(|]', succ): # Followed by span edge v = -1 elif re.search('[)+]', succ) \ and re.search('0[+(]', x): # Dependent v = +1 return Mark('SpreadNasL', v, subnode='nasal')
def NoNasVoc(t): # Vocoids must be [-nasal] v = 0 x = t.olabel if re.search('[GV]', x): if re.search('[-]', x): v = +1 else: v = -1 return Mark('NoNasVoc', v, subnode='nasal')
def SyllStrucL(t): v = 0 x, succ = t.olabel, get_succ(t) if re.search('[TSNG]', succ) \ and re.search('[TSNG]', x): # No clusters v = -1 elif re.search('[V]', succ) \ and re.search('[V]', x): # No hiatus v = -1 return Mark('SyllStrucL', v)
def SyllStrucR(t): v = 0 prec, x = get_prec(t), t.olabel if re.search('[TSNG]', prec) \ and re.search('[TSNG]', x): # No clusters v = -1 elif re.search('[V]', prec) \ and re.search('[V]', x): # No hiatus v = -1 return Mark('SyllStrucR', v)
def NoNasObs(t): # Obstruents must be [-nasal] v = 0 x = t.olabel if re.search('[TS]', x): if re.search('[-]', x): v = +1 else: v = -1 return Mark('NoNasObs', v, subnode='nasal')
def SpreadNasR(t): # Segments immediately following span members must be dependents v = 0 prec, x = get_prec(t), t.olabel if re.search('[)|]', prec): # Preceded by span edge v = -1 elif re.search('[(+]', prec) \ and re.search('0[+)]', x): # Dependent v = +1 return Mark('SpreadNasR', v, subnode='nasal')
def NasN(t): # Nasals must be [+nasal] and span heads v = 0 x = t.olabel if re.search('[N]', x): #if re.search('[-]', label): # N must be [+nasal] if re.search('1', x): # N must be head of +nasal span v = +1 else: v = -1 return Mark('NasN', v, subnode='nasal')
def Lower(t): # Vowels should be [-high] when adjacent to uvulars v = 0 prec, x, succ = \ get_prec(t), t.olabel, get_succ(t) if re.search('[q]', prec) or re.search('[q]', succ): if re.search('[eoa]', x): v = +1 elif re.search('[iu]', x): v = -1 return Mark('Lower', v, subnode='high')
def MainFootRight(s): # Assign -1.0 to main-stress foot that is not rightmost foot v = 0 if is_foot(s): t = s while (t.right_sibling() is not None): t = t.right_sibling() if is_foot(t): v = -1 break return Mark('MainFootRight', v, subnode='upper')
def SyllStruc(t): v = 0 prec, x, succ = get_prec(t), t.olabel, get_succ(t) if (prec == fst_config.bos or prec in consonants) \ and (succ == fst_config.eos or succ in consonants) \ and x in consonants: # No #CC, CC#, #C#, CCC v = -1 elif (prec == fst_config.bos or prec in vowels) \ and x in vowels: # No <V, VV v = -1 return Mark('SyllStruc', v)
def NoClashR(t): # Assign -1.0 to x and +1.0 to o in the context / x __ s = t.left_sibling() if s is not None and s.label() == 'x': if t.label == 'x': v = -1 elif t.label == 'o': v = +1 else: v = 0 return Mark('NoClashR', v)
def NoLapseL(t): # Assign -1.0 to o and +1.0 to x in the context / __ o s = t.right_sibling() if s is not None and s.label() == 'o': if t.label == 'o': v = -1 elif t.label == 'x': v = +1 else: v = 0 return Mark('NoLapseL', v)