Replace deprecated MultiTerm add() method from LWC parser
Change-Id: I516c18611b4e6913ad029c7d43cf011175d36270
diff --git a/lib/KorAP/XML/Annotation/LWC/Dependency.pm b/lib/KorAP/XML/Annotation/LWC/Dependency.pm
index b7532f4..e57ba1e 100644
--- a/lib/KorAP/XML/Annotation/LWC/Dependency.pm
+++ b/lib/KorAP/XML/Annotation/LWC/Dependency.pm
@@ -23,6 +23,8 @@
my $rel = $content->{rel};
$rel = [$rel] unless ref $rel eq 'ARRAY';
+ my $mt;
+
# Iterate over relations
foreach (@$rel) {
my $label = $_->{-label};
@@ -38,35 +40,32 @@
if ($target) {
# Unary means, it refers to itself!
- $mtt->add(
- term => '>:lwc/d:' . $label,
- pti => 32, # term-to-term relation
- payload =>
- '<i>' . $target->get_pos # . # right part token position
+ $mt = $mtt->add_by_term('>:lwc/d:' . $label);
+ $mt->set_pti(32); # term-to-term relation
+ $mt->set_payload(
+ '<i>' . $target->get_pos # . # right part token position
# '<s>0' . # $source_term->tui . # left part tui
# '<s>0' # . $target_term->tui # right part tui
- );
+ );
- my $target_mtt = $stream->pos($target->get_pos);
+ $mt = $stream->pos($target->get_pos)
+ ->add_by_term('<:lwc/d:' . $label);
- $target_mtt->add(
- term => '<:lwc/d:' . $label,
- pti => 32, # term-to-term relation
- payload =>
- '<i>' . $source->get_pos # . # left part token position
+ $mt->set_pti(32); # term-to-term relation
+ $mt->set_payload(
+ '<i>' . $source->get_pos # . # left part token position
# '<s>0' . # $source_term->tui . # left part tui
# '<s>0' # . $target_term->tui # right part tui
- );
+ );
}
# Relation is possibly term-to-element
# with a found target!
elsif ($target = $tokens->span($from, $to)) {
- $mtt->add(
- term => '>:lwc/d:' . $label,
- pti => 33, # term-to-element relation
- payload =>
- '<i>' . $target->get_o_start . # end position
+ $mt = $mtt->add_by_term('>:lwc/d:' . $label);
+ $mt->set_pti(33); # term-to-element relation
+ $mt->set_payload(
+ '<i>' . $target->get_o_start . # end position
'<i>' . $target->get_o_end . # end position
'<i>' . $target->get_p_start . # right part start position
'<i>' . $target->get_p_end # . # right part end position
@@ -74,12 +73,11 @@
# '<s>0' # . $target_span->tui # right part tui
);
- my $target_mtt = $stream->pos($target->get_p_start);
- $target_mtt->add(
- term => '<:lwc/d:' . $label,
- pti => 34, # element-to-term relation
- payload =>
- '<i>' . $target->get_o_start . # end position
+ $mt = $stream->pos($target->get_p_start)
+ ->add_by_term('<:lwc/d:' . $label);
+ $mt->set_pti(34); # element-to-term relation
+ $mt->set_payload(
+ '<i>' . $target->get_o_start . # end position
'<i>' . $target->get_o_end . # end position
'<i>' . $target->get_p_end . # right part end position
'<i>' . $source->get_pos # . # left part token position