Fixed feature treatment in CMC morpho
Change-Id: I242027df72ac9cc67fa4b1845308ff0b16ea8caa
diff --git a/lib/KorAP/XML/Annotation/CMC/Morpho.pm b/lib/KorAP/XML/Annotation/CMC/Morpho.pm
index 94fd291..35335cd 100644
--- a/lib/KorAP/XML/Annotation/CMC/Morpho.pm
+++ b/lib/KorAP/XML/Annotation/CMC/Morpho.pm
@@ -13,9 +13,14 @@
my $content = $token->hash->{fs}->{f};
+ my $array = $content->{fs}->{f};
+
+ # In case there is only a lemma/pos ...
+ $array = ref $array ne 'ARRAY' ? [$array] : $array;
+
my $found;
- foreach my $f (@{$content->{fs}->{f}}) {
+ foreach my $f (@$array) {
# pos tag
if (($f->{-name} eq 'pos') &&
diff --git a/lib/KorAP/XML/Tokenizer.pm b/lib/KorAP/XML/Tokenizer.pm
index a7b0fc8..067dc70 100644
--- a/lib/KorAP/XML/Tokenizer.pm
+++ b/lib/KorAP/XML/Tokenizer.pm
@@ -73,6 +73,7 @@
# TODO: Reuse the following code from Spans.pm and Tokens.pm
my ($tokens, $error);
+
try {
local $SIG{__WARN__} = sub {
$error = 1;
@@ -84,6 +85,7 @@
attr => '-'
)->{layer}->{spanList};
} catch {
+
$self->log->warn('Token error in ' . $path . ($_ ? ': ' . $_ : ''));
$error = 1;
};