UI

chaininglib.ui.dfui.create_save_dataframe_ui(df, filename=None)[source]

This function builds a GUI for saving the results of some lexicon or corpus query to a .csv file. One can use load_dataframe(filepath) to reload the results later on.

Parameters:
  • df – a Pandas DataFrame
  • filename (Optional) – a filename
Returns:

N/A

chaininglib.ui.dfui.display_df(dfs, labels=None, mode='table', index=None)[source]

This function shows the content of one or more Pandas DataFrames. When dealing with more DataFrames, those should be part of a dictionary associating labels (eg. corpus or lexicon names) to DataFrames (values).

Parameters:
  • results – a Pandas DataFrames, or a dictionary of Pandas DataFrames
  • labels – a label, or a list of labels corresponding to the Pandas DataFrames in the first parameter
  • mode (Optional) – way of displaying, one of ‘table’ (default) or ‘chart’
  • index (Optional) – name of a column to be used as Y-axis (index) in a horizontal chart
Returns:

N/A

>>> # call with a single pattern
>>> df_corpus = create_corpus(corpus_to_search).pattern(some_query).search().kwic()
>>> display_df(df_corpus)
>>> # call with a list of pattern
>>> list_of_queries = [ corpus_query(lemma=syn) for syn in syn_list ]
>>> result_dict = create_corpus(corpus).pattern(list_of_queries).search().kwic()
>>> display_df(result_dict, labels=list(syn_list))
chaininglib.ui.dfui.load_dataframe(filepath)[source]

This functions (re)loads some previously saved Pandas DataFrame

Parameters:filepath – path to the saved Pandas DataFrame (.csv)
Returns:a Pandas DataFrame representing the content of the file
>>> df_corpus = load_dataframe('mijn_resultaten.csv')
>>> display_df(df_corpus, labels="Results:")
chaininglib.ui.dfui.save_dataframe(df, fileName, as_latex=False)[source]

This functions saves a Pandas DataFrame to a csv file on the server, containing the index of the DataFrame as column in the file.

Parameters:
  • df – a Pandas DataFrame
  • filepath – output path to the Pandas DataFrame (.csv)
>>> df_corpus = load_dataframe(df, '/path/to/mijn_resultaten.csv')
chaininglib.ui.search.create_corpus_ui()[source]

This function builds a GUI for corpus search

Parameters:N/A
Returns:N/A
chaininglib.ui.search.create_lexicon_ui()[source]

This function builds a GUI for lexicon search.

Parameters:N/A
Returns:N/A
chaininglib.ui.status.remove_wait_indicator()[source]

Removes a wait indicator, indicating that a process (such as search) is going on.

chaininglib.ui.status.show_wait_indicator(message=None)[source]

Shows a wait indicator, indicating that a process (such as search) is going on.

Parameters:message – The message shown by the wait indicator