Beispiel #1
0
 def setUp(self):
     module_path = os.path.dirname(os.path.realpath(__file__))
     self.module_path = module_path
     self.lm3Extractor = SourceLMFeatureExtractor(
         corpus_file=os.path.join(module_path, 'test_data/training.txt'))
     self.lm5Extractor = SourceLMFeatureExtractor(corpus_file=os.path.join(
         module_path, 'test_data/training.txt'),
                                                  order=5)
Beispiel #2
0
 def test_source_lm_no_source(self):
     slmFE = SourceLMFeatureExtractor(
         os.path.join(self.module_path,
                      '../../experiment/tiny_test/europarl.1000.en'))
     obj = {
         'token': u'hits',
         'index': 2,
         'target': [u'a', u'boy', u'hits', u'a', u'dog']
     }
     with self.assertRaises(NoDataError):
         slmFE.get_features(obj)