-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce support for CorpusExplorer
Change-Id: I2133463dbf5e851b371e46f4b9c76bba71611532
- Loading branch information
Showing
20 changed files
with
26,924 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
0.56 2024-06-05 | ||
- Add support für corpusexplorer. | ||
|
||
0.55 2024-06-04 | ||
- Add support for xenodata to i5. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package KorAP::XML::Annotation::CorpusExplorer::Morpho; | ||
use KorAP::XML::Annotation::Base; | ||
use Mojo::Util qw'trim'; | ||
|
||
sub parse { | ||
my $self = shift; | ||
|
||
$$self->add_tokendata( | ||
foundry => 'corpusexplorer', | ||
layer => 'morpho', | ||
cb => sub { | ||
my ($stream, $token) = @_; | ||
my $mtt = $stream->pos($token->get_pos); | ||
|
||
my $content = $token->get_hash->{fs}->{f} or return; | ||
|
||
$content = ref $content ne 'ARRAY' ? [$content] : $content; | ||
|
||
my $start = $token->get_hash->{-from}; | ||
|
||
# Iterate over feature structures | ||
foreach my $fs (@$content) { | ||
$content = $fs->{fs}->{f} or next; | ||
|
||
foreach (@$content) { | ||
|
||
next unless $_->{'#text'}; | ||
my $value = trim $_->{'#text'} or next; | ||
|
||
# POS | ||
if ($_->{-name} eq 'ctag') { | ||
$mtt->add_by_term('cex/p:' . $value); | ||
} | ||
|
||
# Lemma | ||
elsif ($_->{-name} eq 'lemma') { | ||
$mtt->add_by_term('cex/l:' . $value); | ||
} | ||
|
||
# Phrase | ||
elsif ($_->{-name} eq 'phrase') { | ||
$mtt->add_by_term('cex/phrase:' . $value); | ||
}; | ||
|
||
if ($start == 809) { | ||
warn $mtt->to_string; | ||
warn $value; | ||
}; | ||
}; | ||
}; | ||
}) or return; | ||
|
||
return 1; | ||
}; | ||
|
||
sub layer_info { | ||
['cex/p=tokens','cex/l=tokens','cex/phrase=tokens']; | ||
}; | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.