From: Tara L Andrews Date: Mon, 4 Jun 2012 00:08:51 +0000 (+0200) Subject: remove unconditional dep on Morph::Perseus X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=772edba80a9590a86b2d4e5a5d6d82392ade5933;p=scpubgit%2Fstemmatology.git remove unconditional dep on Morph::Perseus --- 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 "