def test_concordance_export_dataframe(germaparl): corpus = get_corpus(germaparl) query = ('[word="\\["] @1[lemma="CDU"] "/" "CSU" [word="\\]"]') result = corpus.query(query, context_break='s') concordance = Concordance(corpus, result.df) line = result.df.iloc[0] text_line = concordance._export(line.name, line, p_show=['word', 'pos'], form='dataframe') assert (isinstance(text_line, pd.DataFrame))
def test_concordance_export_dict(germaparl): corpus = get_corpus(germaparl) query = ('[word="\\["] @1[lemma="CDU"] "/" "CSU" [word="\\]"]') result = corpus.query(query) concordance = Concordance(corpus, result.df) line = result.df.iloc[0] text_line = concordance._export(line.name, line, p_show=['word', 'pos'], form='dict') assert (isinstance(text_line, dict)) assert ('cpos' in text_line)