incorporate user auth functionality
[scpubgit/stemmatology.git] / lib / Text / Tradition / Language / Greek.pm
CommitLineData
0ce8c0cf 1package Text::Tradition::Language::Greek;
2
3use strict;
4use warnings;
5use Module::Load;
6use parent qw/ Text::Tradition::Language::Perseus /;
7
8=head1 NAME
9
10Text::Tradition::Language::Greek - language-specific module for Greek
11
12=head1 DESCRIPTION
13
14Implements morphology lookup for Greek words in context. This module
15depends on the Lingua::Morph::Perseus module for access to PhiloLogic database data.
16
17=head1 SUBROUTINES
18
19=head2 lemmatize( $text )
20
21Evaluates the string using Treetagger and Perseus, and returns the results.
22
23=begin testing
24
25use Text::Tradition;
26use_ok( 'Text::Tradition::Language::Greek' );
27
28eval "use Lingua::Morph::Perseus";
29my $err = $@;
30
31SKIP: {
32 skip "Greek linguistic data not read yet";
33
34 my $trad = Text::Tradition->new(
35 'language' => 'Greek',
36 'file' => 't/data/florilegium_graphml.xml',
37 'input' => 'Self' );
38 $trad->lemmatize();
39 my $ambig = 0;
40 foreach my $r ( $trad->collation->readings ) {
41 next if $r->is_meta;
42 ok( $r->has_lexemes, "Reading $r has one or more lexemes" );
43 my @lex = $r->lexemes;
44 my $lexstr = join( '', map { $_->string } @lex );
45 my $textstr = $r->text;
46 $textstr =~ s/\s+//g;
47 is( $textstr, $lexstr, "Lexemes for reading $r match the reading" );
48 foreach my $l ( @lex ) {
49 next unless $l->matches;
50 next if $l->is_disambiguated;
51 printf( "Ambiguous lexeme %s for reading %s:\n\t%s\n", $l->string, $r->id,
52 join( "\n\t", map { $_->lemma . ': ' . $_->morphology->to_string } $l->matching_forms ) );
53 $ambig++;
54 }
55 }
56 is( $ambig, 4, "Found 4 ambiguous forms as expected" );
57}
58
59=end testing
60
61=cut
62
63our $dbhandle;
64
65sub lemmatize {
66 return __PACKAGE__->perseus_lemmatize( @_ );
67}
68
69sub reading_lookup {
70 return __PACKAGE__->perseus_reading_lookup( @_ );
71}
72
731;