X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2Fstemmatology.git;a=blobdiff_plain;f=lib%2FText%2FTradition%2FLanguage%2FLatin.pm;h=7873c54b17fabb35de50690c99480400dc0e0b39;hp=935547ada76f0515291dee8512c8e4a430c2aa24;hb=772edba80a9590a86b2d4e5a5d6d82392ade5933;hpb=75ae2b25a9925f075714d1471b211db3c30ffb10 diff --git a/lib/Text/Tradition/Language/Latin.pm b/lib/Text/Tradition/Language/Latin.pm index 935547a..7873c54 100644 --- a/lib/Text/Tradition/Language/Latin.pm +++ b/lib/Text/Tradition/Language/Latin.pm @@ -3,7 +3,6 @@ package Text::Tradition::Language::Latin; use strict; use warnings; use Module::Load; -use Morph::Perseus::Structure; use Text::Tradition::Language::Base qw/ lemmatize_treetagger treetagger_struct lfs_morph_tags /; use TryCatch; @@ -163,6 +162,7 @@ sub morphology_tags { sub _perseus_lookup_tt { my( $orig, $pos, $lemma ) = split( /\t/, $_[0] ); _morph_connect(); + return unlesss $morph; my $result = $morph->lookup( $orig ); # Discard results that don't match the lemma, unless lemma is unknown my @orig = @{$result->{'objects'}}; @@ -211,6 +211,7 @@ sub morphology_tags { sub _perseus_lookup_str { my( $orig ) = @_; _morph_connect(); + return unless $morph; # Simple morph DB lookup, and return the results. my $result = $morph->lookup( $orig ); return map { _wordform_from_row( $_ ) } @{$result->{'objects'}}; @@ -222,6 +223,7 @@ sub _wordform_from_row { my( $rowobj ) = @_; my $mpstruct; try { + # M::P::St will be loaded already if we got here $mpstruct = Morph::Perseus::Structure->from_tag( $rowobj->code ); } catch { warn "Could not create morphology structure from "