commit | 011209887ad0d8ab90ead02d69500f1bf19f97cc | [log] [tgz] |
---|---|---|
author | lora-sp <lora.spassova@swhk.ids-mannheim.de> | Thu Apr 06 11:32:00 2023 +0200 |
committer | lora-sp <lora.spassova@swhk.ids-mannheim.de> | Thu Apr 06 11:32:00 2023 +0200 |
tree | 5d45fb48a84cf57abed52f50508a3b03d936adb5 | |
parent | 090514f9e5f22fd8dd834c2440925e2453d26f86 [diff] |
updated escape script Change-Id: Ib7fdf65e09b2b36e0d6cd194c0aa4445a5bfbc2a
This tool is to be used on data from the Bulgarian National Corpus. It contains two script files,bunc2tei.py
and escape_amp.py
.
The script bunc2tei.py
can be executed with the command bunc2tei.py *.xml
inside a directory containing the data.
teiCorpus
as its root.tree_structure
in a new folder called input
. This file will serve as the tree from which the new corpus will be built.convert
. Convert
tries parsing the xml file. If the parsing fails, the xml file is faulty and needs to be cleaned first. This is done by the script escape_amp.py
and will be explained in the next section. If the parsing succeeds, the file is converted and appended to the corpus:The resulting corpus file is stored in the file corpus.p5.xml
inside the folder output
.
The script escape_amp.py
aims at fixing xml files that cannot be processed due to unescaped symbols. In the Bulgarian National Corpus, this was the case for ampersand symbols inside text elements. The script can be executed using escape_amp.py *.xml
inside a directory containing the data.
escape
.Escape
looks for all &
-symbols that are not yet escaped and that are not themselves used to escape another symbol using a regular expression.&
-symbols are replaced by their escaped variant inside the file.