Beispiel #1
0
    def setUp(self):

        session = (
            '@UTF8\n'
            '@Begin\n'
            '@Languages:\tsme\n'
            '@Date:\t12-SEP-1997\n'
            '@Participants:\tMEM Mme_Manyili Grandmother , '
            'CHI Hlobohang Target_Child\n'
            '@ID:\tsme|Sesotho|MEM||female|||Grandmother|||\n'
            '@ID:\tsme|Sesotho|CHI|2;2.||||Target_Child|||\n'
            '@Birth of CHI:\t14-JAN-2006\n'
            '@Birth of MEM:\t11-OCT-1974\n'
            '@Media:\th2ab, audio\n'
            '@Comment:\tall snd kana jmor cha ok Wakachi2002;\n'
            '@Warning:\trecorded time: 1:00:00\n'
            '@Comment:\tuses desu and V-masu\n'
            '@Situation:\tAki and AMO preparing to look at book , '
            '"Miichan no otsukai"\n'
            '*MEM:\tke eng ? 0_8551\n'
            '%gls:\tke eng ?\n'
            '%cod:\tcp wh ?\n'
            '%eng:\tWhat is it ?\n'
            '%sit:\tPoints to tape\n'
            '%com:\tis furious\n'
            '%add:\tCHI\n'
            '*CHI:\tke ntencha ncha . 8551_19738\n'
            '%gls:\tke ntho e-ncha .\n'
            '%cod:\tcp thing(9 , 10) 9-aj .\n'
            '%eng:\tA new thing\n'
            '%com:\ttest comment\n'
            '*MEM:\tke eng ntho ena e? 19738_24653\n'
            '%gls:\tke eng ntho ena e ?\n'
            '%cod:\tcp wh thing(9 , 10) d9 ij ?\n'
            '%eng:\tWhat is this thing ?\n'
            '%sit:\tPoints to tape\n'
            '*CHI:\te nte ena . 24300_28048\n'
            '%gls:\tke ntho ena .\n'
            '%cod:\tcp thing(9 , 10) d9 .\n'
            '%eng:\tIt is this thing\n'
            '*MEM:\tke khomba\n'
            '\tkhomba . 28048_31840\n'
            '%gls:\tkekumbakumba .\n'
            '%cod:\tcp tape_recorder(9 , 10) .\n'
            '%eng:\tIt is a stereo\n'
            '@End')

        self.reader = InuktitutReader(io.StringIO(session))
        self.reader.load_next_record()
        self.maxDiff = None
Beispiel #2
0
 def get_reader(session_file):
     return InuktitutReader(session_file)
Beispiel #3
0
    def test_parse(self):
        """Test parse()."""
        session_str = (
            '@Participants:\tMAE Maemae Mother , RO Roro Target_Child\n'
            '@ID:\tsme|Inuktitut|MAE||female|||Mother|||\n'
            '@ID:\tsme|Inuktitut|RO||female|||Target_Child|||\n'
            '*RO:\tAllaigutama  .\n'
            '%eng:\tGive me a comb  .\n'
            '%xmor:\tNR|ollaoguto^comb+NI|mim^MOD_SG .\n'
            '%tim:\t00:01:32\n'
            '%add:\tMAE\n'
            '@End'
        )
        parser = InuktitutSessionParser(self.dummy_cha_path)
        parser.reader = InuktitutReader(io.StringIO(session_str))
        session = parser.parse()

        utt = session.utterances[0]

        utterance = [
            utt.source_id == 'dummy_0',
            utt.speaker.code == 'RO',
            utt.addressee.code == 'MAE',
            utt.childdirected is False,
            utt.utterance_raw == 'Allaigutama  .',
            utt.utterance == 'Allaigutama',
            utt.translation == 'Give me a comb  .',
            utt.morpheme_raw == 'NR|ollaoguto^comb+NI|mim^MOD_SG .',
            utt.gloss_raw == 'NR|ollaoguto^comb+NI|mim^MOD_SG .',
            utt.pos_raw == 'NR|ollaoguto^comb+NI|mim^MOD_SG .',
            utt.sentence_type == 'default',
            utt.start_raw == '00:01:32',
            utt.end_raw == '',
            utt.comment == '',
            utt.warning == ''
        ]

        w = utt.words[0]

        words = [
            w.word_language == '',
            w.word == 'Allaigutama',
            w.word_actual == 'Allaigutama',
            w.word_target == 'Allaigutama',
            w.warning == ''
        ]

        m1 = utt.morphemes[0][0]
        m2 = utt.morphemes[0][1]

        morphemes = [
            m1.morpheme_language == 'Inuktitut',
            m1.morpheme == 'ollaoguto',
            m1.gloss_raw == 'comb',
            m1.pos_raw == 'NR',

            m2.morpheme_language == 'Inuktitut',
            m2.morpheme == 'mim',
            m2.gloss_raw == 'MOD_SG',
            m2.pos_raw == 'NI'
        ]

        assert (False not in utterance
                and False not in words
                and False not in morphemes)