示例#1
0
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)
示例#2
0
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)
示例#3
0
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)
示例#4
0
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')
示例#5
0
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')
示例#6
0
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')
示例#7
0
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)
示例#8
0
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')
示例#9
0
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)
示例#10
0
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)
示例#11
0
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')
示例#12
0
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')
示例#13
0
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')
示例#14
0
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)
示例#15
0
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)
示例#16
0
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')
示例#17
0
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')
示例#18
0
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')
示例#19
0
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')
示例#20
0
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')
示例#21
0
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)
示例#22
0
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)
示例#23
0
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)