Esempio n. 1
0
    def predictLM(self):
        """ Predict landmarks from generated phonemes."""
        phns = self.get_tier('phones')
        lm_tier = LMTier(name="predicted", xmin = self.xmin, xmax=self.xmax)                
##        g_tier = PointTier(name="g", xmin = self.xmin, xmax=self.xmax)
##        n_tier = PointTier(name="v",xmin = self.xmin, xmax=self.xmax)

        prev = Phoneme(0,0)
        for phn in phns:
            # generate landmark from phoneme pairs
            lm=LMref.predict_table[LMref.phoneme_class(prev.text)][LMref.phoneme_class(phn.text)]            
            if lm!='':
                lm_tier.insert(LMPoint(phn.xmin, lm))
                
##            # glottalization
##            if is_voiced(prev.text) and not is_voiced(phn):
##                g_tier.insert(Point(phn.xmin, mark='-g'))
##            elif is_voiced(phn) and not is_voiced(prev.text):
##                g_tier.insert(Point(phn.xmin, mark='+g'))
##            # velopharyngeal
##            if is_nasal(prev.text) and not is_nasal(phn):
##                n_tier.insert(Point(phn.xmin, mark='-n'))
##            elif is_nasal(phn) and not is_nasal(prev.text):
##                n_tier.insert(Point(phn.xmin, mark='+n'))
                
            prev=phn
        
        self.append(LMTier.lmTier(lm_tier).splitLMs())
        return self.tiers[-1]
Esempio n. 2
0
    def predictLM(self):
        """ Predict landmarks from generated phonemes."""
        phns = self.get_tier('phones')
        lm_tier = LMTier(name="predicted", xmin=self.xmin, xmax=self.xmax)
        ##        g_tier = PointTier(name="g", xmin = self.xmin, xmax=self.xmax)
        ##        n_tier = PointTier(name="v",xmin = self.xmin, xmax=self.xmax)

        prev = Phoneme(0, 0)
        for phn in phns:
            # generate landmark from phoneme pairs
            try:
                lm = LMref.predict_table[LMref.phoneme_class(
                    prev.text)][LMref.phoneme_class(phn.text)]
            except KeyError:
                raise RuntimeError(LMref.phoneme_class(prev.text),
                                   LMref.phoneme_class(phn.text), prev.text,
                                   phn.text, phn.xmax)
            if lm != '':
                lm_tier.insert(LMPoint(phn.xmin, lm))

##            # glottalization
##            if is_voiced(prev.text) and not is_voiced(phn):
##                g_tier.insert(Point(phn.xmin, mark='-g'))
##            elif is_voiced(phn) and not is_voiced(prev.text):
##                g_tier.insert(Point(phn.xmin, mark='+g'))
##            # velopharyngeal
##            if is_nasal(prev.text) and not is_nasal(phn):
##                n_tier.insert(Point(phn.xmin, mark='-n'))
##            elif is_nasal(phn) and not is_nasal(prev.text):
##                n_tier.insert(Point(phn.xmin, mark='+n'))

            prev = phn

        self.append(LMTier.lmTier(lm_tier).splitLMs())
        return self.tiers[-1]
Esempio n. 3
0
    def __init__(self, tmin, tmax, phn='#', t='', n=0, sn=0):
        """ Default values corresponds to a silence interval. """
        Interval.__init__(self, tmin, tmax, phn)

        # manner class of the phoneme (string)
        self.manner = LMref.phoneme_class(phn)

        # Lexical stress (int)
        try:
            self.stress = int(phn[-1])
        except:
            self.stress = -1

        # Syllabic position of phoneme
        # Type (string)
        self.type = t
        # Number (int)
        self.number = n
        # Subnumber (int)
        self.subnumber = sn

        self.links = {}
Esempio n. 4
0
    def __init__(self, tmin, tmax, phn='#', t='', n=0, sn=0):
        """ Default values corresponds to a silence interval. """
        Interval.__init__(self, tmin, tmax, phn)
        
        # manner class of the phoneme (string)
        self.manner = LMref.phoneme_class(phn)
        
        # Lexical stress (int)
        try:
            self.stress = int(phn[-1])
        except:
            self.stress = -1
            
        # Syllabic position of phoneme 
        # Type (string)
        self.type = t
        # Number (int)
        self.number = n
        # Subnumber (int)
        self.subnumber = sn


        self.links = {}