def test_concordance_dict(germaparl): corpus = get_corpus(germaparl) df_dump = corpus.query('[lemma="gehen"]', context=None).df concordance = Concordance(corpus, df_dump) lines = concordance.dict(df_dump, p_show=['word']) assert (isinstance(lines['dict'].iloc[0], dict)) assert ('word' in lines['dict'].iloc[0])
def test_concordance_dataframes(germaparl): corpus = get_corpus(germaparl) query = ('[word="\\["] @1[lemma="CDU"] "/" "CSU" [word="\\]"]') result = corpus.query(query, context_break='s', match_strategy='longest') concordance = Concordance(corpus, result.df) df = concordance.dict(result.df, p_show=['word', 'lemma']) lines = concordance.dataframe(df, p_show=['word', 'lemma']) assert ('dataframe' in lines.columns) assert (isinstance(lines['dataframe'].iloc[0], pd.DataFrame))