Skip to content

Commit

Permalink
script for moving the popular newword files into xml format (note: th…
Browse files Browse the repository at this point in the history
…e script must include translations should they show up
  • Loading branch information
Trondtr committed Jun 7, 2024
1 parent cbc15b1 commit 631e0d9
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/scripts/lexc-to-xml.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/perl -w
use utf8 ;

# Simple script to convert csv to xml
# For input/outpus examples, see below.


print STDOUT "<r>\n";

while (<>)
{
chomp ;
my ($lemma, $POS, $stem, $contlex) = split /\t/ ;
print STDOUT " <e>\n";
print STDOUT " <lg>\n";
print STDOUT " <l pos=\"$POS\">$lemma</l>\n";
print STDOUT " <stg>\n";
print STDOUT " <st Contlex=\"$contlex\">$stem</st>\n";
print STDOUT " </stg>\n";
print STDOUT " </lg>\n";
print STDOUT " <mg>\n";
print STDOUT " <tg xml:lang=\"fin\">\n";
print STDOUT " <t pos=\"$POS\"></t>\n";
print STDOUT " </tg>\n";
print STDOUT " </mg>\n";
print STDOUT " </e>\n";
}

print STDOUT "</r>\n";



# Example input:
#
# aampumakenttä N skytefelt


#Target output:
#
# <e src="yr">
# <lg>
# <l pos="N">aampumakenttä</l>
# </lg>
# <mg>
# <tg>
# <t pos="N" gen="x">skytefelt</t>
# </tg>
# </mg>
# </e>
#

0 comments on commit 631e0d9

Please sign in to comment.