blob: 81c995d9aa8b472a094ac31f9af93dfbac07ac31 [file] [log] [blame]
Harald Lüngen9d4e0462024-08-23 09:34:22 +03001#! /usr/bin/perl -w
2
3
4###########################################################################################################################################################
5# vrt2tei.pl
6# eureco
7# leibniz-institut fuer deutsche sprache / csc finland esbo
8# august 2024
9#
10#
11# using XML::Twig , see http://www.xmltwig.org/, https://metacpan.org/pod/XML::Twiga
12#
13# usage: see below the usage function
Harald Lüngencaab0802024-08-23 17:28:22 +030014# Usage: ./vrt2tei.pl <vrtxmlfile.xml> <outfile>
Harald Lüngen9d4e0462024-08-23 09:34:22 +030015# <vrtxmlfile>: xml-ised vrt file
16#
17#
18# TODO:
19# 1 insert dtd spec, or ref to TEI
20
21# 3a UPLOAD in GITHUB
22# 3b add @head and @deprel to I5 sowie auch @msd
23# 3c bearbeitung von @head und @deprel in tei2korapxml durch Nils?
24# 3d build 30 billion corpus
25
26# 4a take care of IDs
27# 4b see to the values of @xml:lang
28# 5 abfangen von unerwarteten elementen dh andere als <sentence> und <paragraph>
29# 5a wort reihenfolge nochmal checken
30# 6 checks and balances
31# 6a output nach stdout machen
32# 7 How to encode Kielipankki and National Library of Finland? in teiCorpus Header
33# 8 construct <idsDoc>s for the months (or go for TEI)
34# 9 parallelisation in bash and application on sub corpora of KLK
35# 10 re-implementation of the gawk code in the perl script
36# 12 re-implement creation of text header from xml file in another twig / parametrize TEI vs I5
37
38
39
40#remember
41#formatted.xml:105613: element w: validity error : No declaration for attribute deprel of element w
42#formatted.xml:105613: element w: validity error : No declaration for attribute head of element w
43
44
45#
46#
47############################################################################################################################################################
48
49
50use strict;
51use warnings;
52
53use XML::Twig;
54use XML::Generator ':pretty'; # apparently no effect when using flush();
55
56
57use locale; # diese drei Zeilen, damit \b im regex nicht Umlaute und ß matcht.
58use POSIX qw(locale_h); # to be able to use setlocale()
59#setlocale(LC_ALL,'de_DE');
60setlocale(LC_ALL, "fi_FI");
61use utf8;
62use open qw( :std :encoding(UTF-8) );
63
64use Time::Piece;
65use Tie::IxHash;
66
67#----------------------
68# check file arguments:
69#----------------------
70
71# arg0 infile: vrt-xml
72# arg1 outfile: tei
73
74unless($ARGV[1]) {&usage_message()}; # min arg0 und arg1
75if ($ARGV[2]) {&usage_message()}; # max arg1
76
77
78
79
80####################
81# GLOBAL VARIABLES
82####################
83
84my $encoding = "UTF-8";
85#my $encoding = "iso-8859-1"; # dieses $encoding ist NUR fuer das output s.u. twig funktion
Harald Lüngencaab0802024-08-23 17:28:22 +030086my $textcounter = 0;
Harald Lüngen9d4e0462024-08-23 09:34:22 +030087
88
89#####################
90# M A I N
91#####################
92
93
94# open result file and initialise filehandle
95open(my $OUT, ">> $ARGV[1]") || die("cannot open file: $ARGV[1]");
96
97
98
99#-----------------------------------------------------------------------------------
100# start twig and call start tag handler for root and twig handler for each <text>
101#-----------------------------------------------------------------------------------
102
103my $twig="";
104
105$twig = new XML::Twig(
106 keep_spaces => 1, # dadurch auch whitespaces an ehemeligen elementgrenzen im output
107 keep_atts_order => 1, # requires Tie::IxHash
108 pretty_print => 'indented',
109 start_tag_handlers => {
110 texts => \&root
111 },
112 twig_handlers => {
113 text => \&text
114 },
115 # dtd_handlers => { # ToDo for I5
116 # \&set_dtd;
117 # }
118 output_encoding => $encoding,
119 );
120
121$twig->parsefile($ARGV[0]);
122
123close($OUT);
124
125
126###########
127# END MAIN
128###########
129
130
131
132
133##############################
134# S U B R O U T I N E S
135##############################
136
137# sub set_dtd [
138# my $twig, $dtd = @_;
139# my $internal = qq|\nPUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n"DTD/xhtml1-strict.dtd"|;
140#
141# $twig->twig_doctype('html', undef, undef, $internal);
142# }
143
144
145
146sub root {
147 my ($twig, $root) =@_;
148
149 $root->set_gi('teiCorpus');
150 $root->set_att("xmlns", 'http://www.tei-c.org/ns/1.0');
151
152 &insertCorpusHeader($root);
153}
154
155
156sub insertCorpusHeader{
157 my ($root) =@_;
158
159 my $teiHeader = $root ->insert_new_elt("first_child", 'teiHeader');
160 my $fileDesc = $teiHeader ->insert_new_elt("last_child", 'fileDesc');
Harald Lüngencaab0802024-08-23 17:28:22 +0300161 my $profileDesc = $teiHeader ->insert_new_elt("last_child", 'profileDesc');
162
Harald Lüngen9d4e0462024-08-23 09:34:22 +0300163 my $titleStmt = $fileDesc ->insert_new_elt("last_child", 'titleStmt');
164 my $title = $titleStmt ->insert_new_elt("last_child", 'title');
165 $title ->set_text(" KLK-fi-2021 for EuReCo");
166
167 my $publicationStmt = $fileDesc ->insert_new_elt("last_child", 'publicationStmt');
168 my $distributor = $publicationStmt->insert_new_elt("last_child", 'distributor');
169 $distributor ->set_text("NOT FOR DISTRIBUTION - to be used locally in EuReCo");
170
171 my $sourceDesc = $fileDesc ->insert_new_elt("last_child", 'sourceDesc');
172 my $bibl = $sourceDesc ->insert_new_elt("last_child", 'bibl');
173 $bibl ->set_text("ToDo");
174
Harald Lüngencaab0802024-08-23 17:28:22 +0300175 my $langUsage = $profileDesc ->insert_new_elt("last_child", 'langUsage');
176 my $language = $langUsage ->insert_new_elt("last_child", 'language');
177 $language ->set_att("ident",'fi');
178 $language ->set_text("Finnish");
Harald Lüngen9d4e0462024-08-23 09:34:22 +0300179}
180
181
182#----------------------------
183# handler &text for <text>
184#----------------------------
185
186sub text {
Harald Lüngen9d4e0462024-08-23 09:34:22 +0300187 my ($twig, $text) = @_;
188
Harald Lüngencaab0802024-08-23 17:28:22 +0300189 $textcounter++; # global variable
190
191 # ToDo: catch all other, unexpected children of root
Harald Lüngen9d4e0462024-08-23 09:34:22 +0300192
193 #--------------------------------------------------------------------------
194 # Get text metadata (attributes of <text>) and create teiHeader for <text>
195 #--------------------------------------------------------------------------
196
197 my $textattsref = $text->atts(); # $textattsref is now a reference to a hash and should be used with '->'
198
199 &createTextHeader($text, $textattsref);
200
201 #--------------------------
202 # create <TEI> from <text>
203 #--------------------------
204
205 # set vrt <text> to <TEI> and delete all attributes after they were were saved above
206 $text->del_atts;
207 $text->set_gi("TEI");
Harald Lüngencaab0802024-08-23 17:28:22 +0300208
Harald Lüngen9d4e0462024-08-23 09:34:22 +0300209 #------------------------------------------------------------------
210 # create the <tei:text>, <body>, <div> elements inside <TEI>
211 #------------------------------------------------------------------
212
213 my $ttext_element = XML::Twig::Elt->new('text');
214 my $body_element = XML::Twig::Elt->new('body');
215 my $div_element = XML::Twig::Elt->new('div');
216
217 # set atts
Harald Lüngencaab0802024-08-23 17:28:22 +0300218 $div_element ->set_att("type", "page"); # ToDo: this is specific to KLK
219 $ttext_element->set_att("xml:lang", 'fi'); # as in ICC-NOR
Harald Lüngen9d4e0462024-08-23 09:34:22 +0300220
221 # paste
222 $ttext_element->paste('last_child', $text);
223 $body_element ->paste('last_child', $ttext_element);
224 $div_element ->paste('last_child', $body_element);
225
226
227 #-------------------------------
228 # create <p> from <paragraph>
229 #-------------------------------
230
231 my @paragraphs = $text->children( 'paragraph');
232
233 foreach my $paragraph (@paragraphs) {
234
235 &setP($paragraph);
236
237 $paragraph->move('last_child', $div_element);
238
239
240 #------------------------------
241 # create <s> from <sentence>
242 #------------------------------
243
244 my @sentences = $paragraph->children('sentence');
245 foreach my $sentence (@sentences) {
246
247 &setS($sentence);
248
249
250 #--------------------------------------
251 # create <w> (word) from each $line
252 #--------------------------------------
253
254 my @lines = split(/\n+/, $sentence->xml_text);
255 $sentence->set_text("\n");
256
257 for my $line (@lines){ # Todo: Reihenfolge checken
258 if($line ne "" ){
259 my $w_element = XML::Twig::Elt->new('w');
260 &createW($w_element, $line);
261 $w_element->paste('last_child', $sentence);
262 }
Harald Lüngencaab0802024-08-23 17:28:22 +0300263 } # end words
264 } # end sentences
265 } # end paragraphs
Harald Lüngen9d4e0462024-08-23 09:34:22 +0300266
Harald Lüngencaab0802024-08-23 17:28:22 +0300267 $twig->flush($OUT);
268} # end texts
Harald Lüngen9d4e0462024-08-23 09:34:22 +0300269
270
271sub createTextHeader{
272 my ($text, $textattsref) = @_;
273
274 # USE 01 binding_id="2246025"
275 # USE 02 date="2021-01-15"
276 # 03 datefrom="20210115"
277 # 04 dateto="20210115"
278 # 05 elec_date="_"
279 # 06 file=""
280 # USE 07 filename_metadata="finclarin_siirto_k2021/0039-5552/2021/alto/2246025_0039-5552_2021-01-15_SK0221_mets.xml"
281 # USE 08 filename_orig ="finclarin_siirto_k2021/0039-5552/2021/alto/2246025_0039-5552_2021-01-15_SK0221_page-2021011502210030301.xml
282 # USE 09 id="t-bcd0f3fa-bbd3dac4"
283 # 10 img_url=""
284 # USE 11 issue_date="15.01.2021"
285 # USE 12 issue_no="SK0221"
286 # USE 13 issue_title="Suomen Kuvalehti"
287 # USE 14 label="Suomen Kuvalehti no. SK0221 15.01.2021"
288 # USE 16 language="fi"
289 # USE 17 page_id="p1"
290 # USE 18 page_no="None"
291 # 19 part_name="_"
292 # 20 publ_id="0039-5552"
293 # 21 publ_part=""
294 # USE 22 publ_title="Suomen Kuvalehti"
295 # USE 23 publ_type="aikakausi"
296 # USE 24 sentcount="70"
297 # USE 25 sum_lang="|xxx:44|fin:23|eng:3|"
298 # 26 timefrom="000000"
299 # 27 timeto="235959"
300 # USE 28 tokencount="304"
301 # 29 version_added="KLK-fi-2021">
302
303
304 my $BID = $textattsref->{'binding_id'};
305 my $DATE = $textattsref->{'date'};
306 my $METAFILENAME = $textattsref->{'filename_metadata'};
307 my $ORIGFILENAME = $textattsref->{'filename_orig'};
308 my $ID = $textattsref->{'id'};
309 my $ISSUEDATE = $textattsref->{'issue_date'};
310 my $ISSUENO = $textattsref->{'issue_no'};
311 my $ISSUETITLE = $textattsref->{'issue_title'};
312 my $LABEL = $textattsref->{'label'};
313 my $LANGUAGE = $textattsref->{'language'};
314 my $PAGEID = $textattsref->{'page_id'};
315 my $PAGENO = $textattsref->{'page_no'};
316 my $PUBLTITLE = $textattsref->{'publ_title'};
317 my $PUBLTYPE = $textattsref->{'publ_type'};
318 my $SENTCOUNT = $textattsref->{'sentcount'};
319 my $SUMLANG = $textattsref->{'sum_lang'};
320 my $TOKENCOUNT = $textattsref->{'tokencount'};
321
322
323 #-----------------------------
324 # Derived Metadata variables
325 #-----------------------------
326
327 my @datearray = split("-", $DATE);
328 my @langarray = split("|", $SUMLANG);
329 my @namearray = split(/[\.\/]/, $ORIGFILENAME); # use $namearray[4] as ID for the page
330
331
332 #-----------------------------------------------------------------------
333 # CREATE text-teiHeader ACCORDING TO THE SKELETON in klk-header.tei.xml
334 #-----------------------------------------------------------------------
335
336 # create <teiHeader> inside <TEI>
337 my $teiHeader = XML::Twig::Elt->new('teiHeader');
338 $teiHeader->paste('first_child', $text);
339
340 ## insert_new_elt is a combo of new and paste, cf. xml::twig docu:
341 ## insert_new_elt ($opt_position, $gi, $opt_atts_hashref, @opt_content)
342
343 my $fileDesc = $teiHeader->insert_new_elt('fileDesc' => {n => "EuReCo_KLK-fi_" . $namearray[4]});
344 my $encodingDesc = $teiHeader->insert_new_elt("last_child", 'encodingDesc');
345 my $profileDesc = $teiHeader->insert_new_elt("last_child", 'profileDesc');
346 my $revisionDesc = $teiHeader->insert_new_elt("last_child", 'revisionDesc');
347
348 #---------------------
349 # fileDesc/titleStmt
350 #---------------------
351 my $titleStmt = $fileDesc ->insert_new_elt('titleStmt');
352 my $title = $titleStmt->insert_new_elt("last_child", 'title');
353 my $respStmt = $titleStmt->insert_new_elt("last_child", 'respStmt');
354 my $resp = $respStmt ->insert_new_elt("last_child", 'resp');
355 my $name = $respStmt ->insert_new_elt("last_child", 'name');
356
357 # set texts for titleStmt
Harald Lüngencaab0802024-08-23 17:28:22 +0300358 # $title->set_text($LABEL . ", page " . $PAGENO); # Achtung - PAGENO scheint meist "None" zu sein
359 $title->set_text($LABEL . ", Text #" . $textcounter); # at least for Suomen Kuvalehti
Harald Lüngen9d4e0462024-08-23 09:34:22 +0300360 $resp ->set_text("compiled by EuReCo");
361 $name ->set_text("EuReCo: HL");
362
363 #--------------------------
364 # fileDesc/publicationStmt
365 #--------------------------
366 my $publicationStmt = $fileDesc ->insert_new_elt("last_child", 'publicationStmt');
367 my $distributor = $publicationStmt->insert_new_elt("last_child", 'distributor');
368 my $note = $distributor ->insert_new_elt("last_child", 'note');
369 my $availability = $publicationStmt->insert_new_elt("last_child", 'availability');
370 my $licence = $availability ->insert_new_elt("last_child", 'licence');
371
372 # set texts for publicationStmt
373 $note ->set_text("NOT FOR DISTRIBUTION - to be used locally in EuReCo");
374 $licence->set_text("CLARIN-RES"); # TODO: Ausfuherlichere Licence info in KLK Metadata Record
375
376 #------------------------------
377 # fileDesc/sourceDesc/biblStruct
378 #------------------------------
379 my $sourceDesc = $fileDesc ->insert_new_elt("last_child", 'sourceDesc');
380 my $biblStruct = $sourceDesc->insert_new_elt("last_child", 'biblStruct');
381
382 # fileDesc/sourceDesc/biblStruct/analytic
383 my $analytic = $biblStruct->insert_new_elt("last_child", 'analytic');
384 my $analytic_title = $analytic->insert_new_elt("last_child", 'title' => {type => "main"} );
385# my $analytic_date = $analytic->insert_new_elt("last_child", 'date');
386 my $analytic_date_year = $analytic->insert_new_elt("last_child", 'date' => {type => "year"});
387 my $analytic_date_month = $analytic->insert_new_elt("last_child", 'date' => {type => "month"});
388 my $analytic_date_day = $analytic->insert_new_elt("last_child", 'date' => {type => "day"});
389 my $analytic_idno_pageid = $analytic->insert_new_elt("last_child", 'idno' => {type => "PAGEID"});
390 my $analytic_idno_bindingid = $analytic->insert_new_elt("last_child", 'idno' => {type => "BINDINGID"});
391 my $analytic_idno_id = $analytic->insert_new_elt("last_child", 'idno' => {type => "ID"});
392 my $analytic_idno_metafile = $analytic->insert_new_elt("last_child", 'idno' => {type => "KIELIPANKKI_METAFILENAME"});
393 my $analytic_idno_origfile = $analytic->insert_new_elt("last_child", 'idno' => {type => "KIELIPANKKI_ORIGFILENAME"});
394 my $analytic_textlang = $analytic->insert_new_elt("last_child", 'textLang');
395
396 # set texts for analytic
Harald Lüngencaab0802024-08-23 17:28:22 +0300397# $analytic_title ->set_text($LABEL . ", page " . $PAGENO); # Achtung $PAGENO scheint meist "None zu sein"
398 $analytic_title ->set_text($LABEL . ", Text #" . $textcounter); # Achtung $PAGENO scheint meist "None zu sein"
Harald Lüngen9d4e0462024-08-23 09:34:22 +0300399# $analytic_date ->set_text($DATE);
400 $analytic_date_year ->set_text($datearray[0]);
401 $analytic_date_month ->set_text($datearray[1]);
402 $analytic_date_day ->set_text($datearray[2]);
403 $analytic_idno_pageid ->set_text($PAGEID);
404 $analytic_idno_bindingid->set_text($BID);
405 $analytic_idno_id ->set_text($ID);
406 $analytic_idno_metafile ->set_text($METAFILENAME);
407 $analytic_idno_origfile ->set_text($ORIGFILENAME);
408 $analytic_textlang ->set_text($LANGUAGE);
409
410 #-------------------------------------
411 # fileDesc/sourceDesc/biblStruct/monogr
412 #-------------------------------------
413 my $monogr = $biblStruct->insert_new_elt("last_child", 'monogr');
414 my $monogr_title = $monogr ->insert_new_elt("last_child", 'title');
415 my $imprint = $monogr ->insert_new_elt("last_child", 'imprint'); # imprint is needed for valididty
416 my $pubPlace = $imprint ->insert_new_elt("last_child", 'pubPlace'); # imprint is needed for validity
417 my $publisher = $imprint ->insert_new_elt("last_child", 'publisher'); # imprint is needed for validity
418 my $biblScope_issuetitle = $monogr ->insert_new_elt("last_child", 'biblScope' => {unit => 'ISSUETITLE'} );
419 my $biblScope_issueno = $monogr ->insert_new_elt("last_child", 'biblScope' => {unit => 'ISSUENO'} );
420 my $biblScope_issuedate = $monogr ->insert_new_elt("last_child", 'biblScope' => {unit => 'ISSUEDATE'} );
421 my $biblScope_pp = $monogr ->insert_new_elt("last_child", 'biblScope' => {unit => 'PAGENO'} ); # Achtung PAGENO ist meist "None" ?
422
423 # set texts for monogr
424 $monogr_title ->set_text($PUBLTITLE);
425 $pubPlace ->set_text("TODO");
Harald Lüngencaab0802024-08-23 17:28:22 +0300426 $pubPlace ->set_att("key",'FI');
Harald Lüngen9d4e0462024-08-23 09:34:22 +0300427 $publisher ->set_text("TODO");
428 $biblScope_issuetitle->set_text($ISSUETITLE);
429 $biblScope_issueno ->set_text($ISSUENO);
430 $biblScope_issuedate ->set_text($ISSUEDATE);
431 $biblScope_pp ->set_text($PAGENO);
432
433 #---------------
434 # encodingDesc
435 #---------------
436 my $tagsDecl = $encodingDesc->insert_new_elt("last_child", 'tagsDecl');
437 my $namespace = $tagsDecl ->insert_new_elt("last_child", 'namespace' => {name => 'http://www.tei-c.org/ns/1.0'});
438 my $tagUsage_s = $namespace ->insert_new_elt("last_child", 'tagUsage' => {gi => 's', occurs => $SENTCOUNT});
439 my $tagUsage_w = $namespace ->insert_new_elt("last_child", 'tagUsage' => {gi => 'w', occurs => $TOKENCOUNT});
440
441 #-------------
442 # profileDesc
443 #-------------
444 my $langUsage = $profileDesc ->insert_new_elt("last_child", 'langUsage');
445 my $language = $langUsage ->insert_new_elt("last_child", 'language' => {ident => $LANGUAGE, usage => $SUMLANG});
446 # Achtung in @usage muss eigt. ein integer; am besten inhalt von SUMLANG aufdroeseln und mehrere <language> machen
447 my $textClass = $profileDesc ->insert_new_elt("last_child", 'textClass');
448 my $classCode_fi = $textClass ->insert_new_elt("last_child", 'classCode' => {scheme => "KLK_PUBLTYPE"});
449# my $classCode_en = $textClass ->insert_new_elt("last_child", 'classCode' => {scheme => "KLK_PUBLTYPE_MAPPED"});
450
451 #---------------------------
452 # set texts for profileDesc
453 #---------------------------
454 $classCode_fi ->set_text($PUBLTYPE);
455# $classCode_en->set_text($PUBLTYPETRANSL);
456
457 #---------------
458 # revisionDesc
459 #---------------
460 my $change = $revisionDesc ->insert_new_elt("last_child", 'change' => {when => localtime->ymd('-'), who => 'HL' });
461
462 # set texts for revisionDesc
463 $change->set_text("TEI version for EuReCo");
464
465
466 ###################################
467 # END OF CREATING TEIHEADER
468 ###################################
469
470}
471
472sub setP {
473 my ($paragraph) = @_;
474
475 $paragraph->set_gi('p');
476
477 # <paragraph id="p-bcd0f3fa-bbd3dac4-815ead7a" sum_lang="|fin:1|">
478 # atts of <paragraph>:
479 # @id USE
480 # @sum_lang USE: put in xml:lang and prefix the value with "x-" for private value
481
482 $paragraph->set_att("xml:lang", "x-" . $paragraph->att("sum_lang"));
483 $paragraph->del_att("sum_lang");
484 $paragraph->change_att_name('id', 'xml:id');
485}
486sub setS {
487 my ($sentence) = @_;
488
489 $sentence->set_gi('s');
490
491 # the atts of <sentence>:
492 # USE 1 @id="s-bcd0f3fa-bbd3dac4-f7429090"
493 # USE 2 @lang="fin" -> xml:lang
494 # ? 3 @lang_conf="0.6734853"> -> ToDo @cert ?
495
496 # set attrs of <s>
497 $sentence->set_att("xml:lang", $sentence->att("lang")); # ToDo: convert the value / introduce a hash for lookup (input values: "fin", "xxx", ....)
498 $sentence->change_att_name('id', 'xml:id');
499 $sentence->del_att("lang"); # replaced by xml:lang
500 $sentence->del_att("lang_conf"); # for the time being
501
502}
503
504sub createW {
505 my ($w_element, $line) = @_;
506
507 #---------------------------
508 # Get the tags (=columns)
509 #---------------------------
510
511 my @tags = split(/\t/, $line);
512
513 # set content of <w> i.e. the token
514 $w_element->set_text($tags[0]);
515
516 # vrt positional-attributes in corpus KLK:
517 # USE [0] word
518 # USE [1] ref (id for reference of dephead)
519 # USE [2] lemma
520 # ? [3] lemmacomp (lemma with compound info - could go in @norm, as tag abuse?)
521 # USE [4] pos
522 # USE [5] msd
523 # USE [6] dephead
524 # USE [7] deprel
525 # [8] content (ocr-process)
526 # [9] vpos (ocr-process)
527 # [10] ocr (ocr-process)
528 # [11] cc (ocr-process)
529 # [12] hyph (ocr-process)
530 # [13] style (ocr-process)
531 # [14] lex (korp semantic disambiguation from G"oteborg)
532
533 # set the attributes of <w>:
534 $w_element->set_att("n", $tags[1]);
535 # $w_element->set_att("id", "w_" . $namearray[4] . $sentence->att("xml:id") . "_" . $tags[1]);
536 # so zusammengebaute ID ist auch nicht eindeutig...
537 $w_element->change_att_name('id', 'xml:id');
538 $w_element->set_att("lemma", $tags[2]);
539 # $w_element->set_att("norm", $tags[3]); # tag abuse of @norm
540 $w_element->set_att("pos", $tags[4]);
541 $w_element->set_att("msd", $tags[5]);
542 $w_element->set_att("head", $tags[6]);
543 $w_element->set_att("deprel", $tags[7]);
544
545}
546
547#################
548## usage_message
549#################
550
551
552sub usage_message {
Harald Lüngena7e91622024-08-23 17:33:11 +0300553 print " Usage: ./vrt2tei.pl <file.vrt.xml> <outfile>\n";
Harald Lüngen9d4e0462024-08-23 09:34:22 +0300554 print " <file.vrt.xml> is a VRT file converted to proper XML\n";
555 exit;
556}
557
558