Commit | Line | Data |
0ce8c0cf |
1 | #!/usr/bin/perl -w |
2 | |
3 | use strict; |
4 | use Test::More 'no_plan'; |
5 | $| = 1; |
6 | |
7 | |
8 | |
9 | # =begin testing |
10 | { |
11 | use Text::Tradition; |
12 | use_ok( 'Text::Tradition::Language::Armenian' ); |
13 | |
14 | eval "use Lingua::Morph::Perseus"; |
15 | my $err = $@; |
16 | |
17 | SKIP: { |
18 | skip "No Armenian test data yet"; |
19 | |
20 | my $trad = Text::Tradition->new( |
21 | 'language' => 'Armenian', |
22 | 'file' => 't/data/legendfrag.xml', |
23 | 'input' => 'Self' ); |
24 | $trad->lemmatize(); |
25 | my $ambig = 0; |
26 | foreach my $r ( $trad->collation->readings ) { |
27 | next if $r->is_meta; |
28 | ok( $r->has_lexemes, "Reading $r has one or more lexemes" ); |
29 | my @lex = $r->lexemes; |
30 | my $lexstr = join( '', map { $_->string } @lex ); |
31 | my $textstr = $r->text; |
32 | $textstr =~ s/\s+//g; |
33 | is( $textstr, $lexstr, "Lexemes for reading $r match the reading" ); |
34 | foreach my $l ( @lex ) { |
35 | next unless $l->matches; |
36 | next if $l->is_disambiguated; |
37 | printf( "Ambiguous lexeme %s for reading %s:\n\t%s\n", $l->string, $r->id, |
38 | join( "\n\t", map { $_->lemma . ': ' . $_->morphology->to_string } $l->matching_forms ) ); |
39 | $ambig++; |
40 | } |
41 | } |
42 | is( $ambig, 4, "Found 4 ambiguous forms as expected" ); |
43 | } |
44 | } |
45 | |
46 | |
47 | |
48 | |
49 | 1; |