def run_query(self): config = self.kwargs['config'] path = self.kwargs['path'] stop_check = self.kwargs['stop_check'] call_back = self.kwargs['call_back'] call_back('Enriching phonological inventory...') call_back(0, 0) with CorpusContext(config) as c: enrich_features_from_csv(c, path) if stop_check(): call_back('Resetting phonological inventory...') call_back(0, 0) c.reset_lexicon() return False return True
def test_feature_enrichment(timed_config, csv_test_dir): path = os.path.join(csv_test_dir, 'timed_features.txt') with CorpusContext(timed_config) as c: enrich_features_from_csv(c, path) q = c.query_graph(c.phone).filter(c.phone.vowel_height == 'lowhigh') q = q.columns(c.phone.label.column_name('label')) res = q.all() assert (all(x['label'] == 'ay' for x in res)) q = c.query_graph(c.phone).filter(c.phone.place_of_articulation == 'velar') q = q.columns(c.phone.label.column_name('label')) res = q.all() assert (all(x['label'] in ['k', 'g'] for x in res))
def test_feature_enrichment(timed_config, csv_test_dir): path = os.path.join(csv_test_dir, 'timed_features.txt') with CorpusContext(timed_config) as c: enrich_features_from_csv(c, path) q = c.query_graph(c.phone).filter(c.phone.vowel_height == 'lowhigh') q = q.columns(c.phone.label.column_name('label')) res = q.all() assert(all(x['label'] == 'ay' for x in res)) q = c.query_graph(c.phone).filter(c.phone.place_of_articulation == 'velar') q = q.columns(c.phone.label.column_name('label')) res = q.all() assert(all(x['label'] in ['k','g'] for x in res))