Quickstart
Before you install bbw, check our short tutorial in binder:
Basic usage of the main functions
To test the main functions, import bbw in Python:
from bbw import bbw
annotate()
The easiest way to annotate the dataframe Y=bbw.pd.DataFrame([['0','1'],['Mannheim','Rhine']])
is:
[web_table, url_table, label_table, cpa, cea, cta] = bbw.annotate(Y)
It returns a list of six dataframes. The first three dataframes contain the annotations in the form of HTML-links, URLs and labels of the entities in Wikidata correspondingly. The dataframes have two more rows than Y. These two rows contain the annotations for types and properties. The last three dataframes contain the annotations in the format required by SemTab2020 challenge.
preprocessing(), contextual_matching() & postprocessing()
The fastest way to annotate the dataframe Y is:
[cpa_list, cea_list, nomatch] = bbw.contextual_matching(bbw.preprocessing(Y))
[cpa, cea, cta] = bbw.postprocessing(cpa_list, cea_list)
The dataframes cpa
, cea
and cta
contain the annotations in SemTab2020-format. The list nomatch
contains the labels which are not matched. The unprocessed and possibly non-unique annotations are in the lists cpa_list
and cea_list
.
GUI (graphical user interface)
If you need to annotate only one table, use the simple GUI:
streamlit run bbw_gui.py
Open the browser at http://localhost:8501 and choose a CSV-file. The annotation process starts automatically. It outputs the six tables of the annotate function.
You can test GUI (without SearX support) at:
CLI (command line tool)
If you need to annotate a few tables, use the CLI-tool:
python3 bbw_cli.py --amount 100 --offset 0
Fast annotations with GNU parallel
If you need to annotate hundreds or thousands of tables, use the script with GNU parallel:
./bbw_parallel.py