mirror: 初始快照

This commit is contained in:
Li_Feiyu committed 2026-10-02 22:51:03 +08:00
commit bf87c99809
1011 files changed
+18247530

No files matched your search

+84
View File
@@ -0,0 +1,84 @@
#!/usr/bin/perl -w
# This program converts a eng-rom database from stdin
# to TEI dictionary format on stdout.
# No sorting is done.
#
# V1.0 GPL´ed 2002 by H.Eyermann
# V1.1 Michael Bunk: simplified script, converted to TEI P4
sub xmlescape
{
my $w = shift;
$w =~ s/&/&/g;
$w =~ s/\'/"/g;
$w =~ s/\"/'/g;
$w =~ s/</&lt;/g;
$w =~ s/>/&gt;/g;
$w;
}
# print the header
system 'cat eng-rom.tei.header';
# read the database from stdin
$orth = "";
while(<>)
{
# if the line doesn't start with whitespace
if(/^(\S+)/)
{
# if we had read an entry before, output it
if($orth)
{
print<<EOF;
<entry>
<form>
<orth>$orth</orth>
$pron </form>
$tran </entry>
EOF
}
# recognize next headword
if(/\:(.+)\:/)
{
$orth = xmlescape($1);
$pron = "";
$tran = "";
}
else
{
chomp;
warn "Line $.: Didn't find headword in '$_'\n"; }
next;
}
# why this, while there is no pronunciation information
# in the dictionary source?
if(/^\[(.*)\]$/)
{
$pron = " <pron>$1</pron>\n";
next;
}
chomp;
next if $_ eq "";
# parse entry contents
foreach $tr (split /,/)
{
$tr =~ s/^\s*//g;# delete leading
$tr =~ s/\s*$//g;# and trailing spaces
$tr = xmlescape($tr);
$tran .= " <trans><tr>$tr</tr></trans>\n";
}
} # while
# print the footer
print<<EOF
</body>
</text>
</TEI.2>
EOF