Keep in mind that bilbo has already been trained on a french and english annotated xml corpus.
It is trained on <note> and <bibl> section.
By default, bilbo2 is running (for annotation) on a specified pipeline with a default pre-trained model (french and english languages on <bibl> tag).
For an overview of different features and CLI command just launch in a shell :
cd bilbo2
bash tools/demo_cli.sh -vYou will see that a quick use, to annotate your bibliographics references (indicate as <bibl> in TEI) just launch :
cd bilbo2
python3 -m bilbo.bilbo --action tag -i PATH_TO_XMLFILE -o XML_OUTPUT_TAGGEDFor annotate your footnote you need first to mention the tag to process (note) and specify explicitely the config file. Currently the config file pipeline_note.cfg is available.
cd bilbo2
python3 -m bilbo.bilbo --action tag -t note -c bilbo/config/pipeline_note.cfg -i PATH_TO_XMLFILE -o XML_OUTPUT_TAGGEDFor train, you just have to change --action=tag to --action=train and given an annotated input xml corpus. Note that output option is not necessay in this case. Saved trained model will be saved at the path indicated in the config file.
Open a terminal:
python3In a interactive python shell:
WARNING! You have to be careful in interactive mode to the relative path of Python interpretor, xml file and of relative/absolute path in the configuration file.from bilbo.importer import Importer
from bilbo.bilbo import Bilbo
importer = Importer("path_to_your_xml_file")
doc = importer.parse_xml('tag(bibl or /note)')
bilb = Bilbo(doc, "path_config_file)
bilb.annotate("path_to_output.xml", format_=None)
Two models and prexisted external list already exists and can be loaded as a data package. You do not need to give the config file path. You just have to load 'bibl' or 'note' with class method load(bibl/note):
from bilbo.importer import Importer
from bilbo.bilbo import Bilbo
importer = Importer("path_to_your_xml_file")
doc = importer.parse_xml('note)')
Bilbo.load('note')
bilbo = Bilbo(doc)
bilb.annotate("path_to_output.xml", format_=None)