def test_text_extractor(self): stim = ComplexTextStim(join(TEXT_DIR, 'sample_text.txt'), columns='to', default_duration=1) td = DictionaryExtractor(join(TEXT_DIR, 'test_lexical_dictionary.txt'), variables=['length', 'frequency']) self.assertEquals(td.data.shape, (7, 2)) timeline = stim.extract([td]) df = TimelineExporter.timeline_to_df(timeline) self.assertEquals(df.shape, (12, 4)) self.assertEquals(df.iloc[9, 3], 10.6)
def test_text_extractor(): stim = ComplexTextStim(join(TEXT_DIR, 'sample_text.txt'), columns='to', default_duration=1) td = DictionaryExtractor(join(TEXT_DIR, 'test_lexical_dictionary.txt'), variables=['length', 'frequency']) assert td.data.shape == (7, 2) timeline = stim.extract([td]) df = timeline.to_df() assert np.isnan(df.iloc[0, 3]) assert df.shape == (12, 4) target = df.query('name=="frequency" & onset==5')['value'].values assert target == 10.6
def test_part_of_speech_extractor(): stim = ComplexTextStim(join(TEXT_DIR, 'complex_stim_with_header.txt')) tl = stim.extract([PartOfSpeechExtractor()]) df = tl.to_df() assert df.iloc[1, 3] == 'NN' assert df.shape == (4, 4)
def test_part_of_speech_extractor(self): stim = ComplexTextStim(join(TEXT_DIR, 'complex_stim_with_header.txt')) tl = stim.extract([PartOfSpeechExtractor()]) df = tl.to_df() self.assertEquals(df.iloc[1, 3], 'NN') self.assertEquals(df.shape, (4, 4))
def test_part_of_speech_extractor(self): stim = ComplexTextStim(join(TEXT_DIR, 'complex_stim_with_header.txt')) tl = stim.extract([PartOfSpeechExtractor()]).to_df() self.assertEquals(tl.iloc[1, 3], 'NN') self.assertEquals(tl.shape, (4, 4))