Пример #1
0
 def setUp (self):
     bfm_configuration = '''
       [Base Features] anterior consonantal voiced
       [Base Characters] a: anterior b: c: anterior, voiced
       [Diacritic Characters] ̬: +voiced
       [Spacing Characters] ʲ: +consonantal ʰ: -anterior
       [Suprasegmental Features] stressed syllabic
       [Suprasegmental Characters] ˈ: +stressed .: +syllabic
       '''
     self.bfm = BinaryFeaturesModelParser().parse(bfm_configuration)
     self.context_component = ContextRuleComponent()
     self.source_component = SourceRuleComponent()
Пример #2
0
class PlaceholderTestCase (unittest.TestCase):

    def setUp (self):
        bfm_configuration = '''
          [Base Features] anterior consonantal voiced
          [Base Characters] a: anterior b: c: anterior, voiced
          [Diacritic Characters] ̬: +voiced
          [Spacing Characters] ʲ: +consonantal ʰ: -anterior
          [Suprasegmental Features] stressed syllabic
          [Suprasegmental Characters] ˈ: +stressed .: +syllabic
          '''
        self.bfm = BinaryFeaturesModelParser().parse(bfm_configuration)
        self.context_component = ContextRuleComponent()
        self.source_component = SourceRuleComponent()

    def test_placeholder_applier_form (self):
        placeholder = Placeholder(self.bfm, self.source_component)
        self.assertEqual(placeholder.applier_form, ')(?P<match>)(?=')
        a = BaseCharacter(self.bfm, 'a')
        cluster = BaseCluster(self.bfm, base_character=a)
        self.source_component.append(cluster)
        self.assertEqual(placeholder.applier_form,
                         ')(?P<match>{})(?='.format(cluster.applier_form))