Skip to content

Commit

Permalink
inline media, fix CZ url #868
Browse files Browse the repository at this point in the history
  • Loading branch information
matyaskopp committed May 7, 2024
1 parent 77ad565 commit ebb1b16
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions Scripts/parlamint2teitok.pl
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@

foreach $media ( $xml->findnodes("//media") ) {
if ( $sname =~ /-CZ/ ) {
$mbase = "https://lindat.mff.cuni.cz/services/teitok/data/parczech/www.psp.cz/eknih/";
$mbase = "https://lindat.mff.cuni.cz/services/teitok/data/parczech/";
};
if ( $mbase ) {
$media->setAttribute("url", $mbase.$media->getAttribute("url"));
Expand Down Expand Up @@ -162,6 +162,21 @@
# Already pb'd
if ( $verbose ) { print "Already pb'd - adding atts later"; };
$dopb = 1;
# inline media if pb contain corresp
foreach $pb ( $xml->findnodes("//text//pb[\@corresp]") ) {
print STDERR $pb->toString;
foreach $corresp (map {s/^#//;$_} split(/\s+/, $pb->getAttribute("corresp"))){
print STDERR $corresp;
my ($audio) = $xml->findnodes("//media[\@xml:id = '$corresp']");
print STDERR $audio->toString;
if($audio){
$audio->unbindNode();
$pb->parentNode->insertAfter($audio,$pb);
}
};
};



} else {
$dcnt = 0; $pbcnt = 0; $scnt = 1;
Expand Down Expand Up @@ -398,8 +413,6 @@ ( $$$ )
$pb->setAttribute("ana", $utt->getAttribute("ana"));
if ( $debug ) { print $pb->toString; } ;
};

# inline media if pb contain corresp
};

`mkdir -p $outf`;
Expand Down

0 comments on commit ebb1b16

Please sign in to comment.