4 use Test::More 'no_plan';
11 binmode STDOUT, ':utf8';
13 use_ok( 'Text::Tradition::Language::French' );
19 skip "Package Flemm not found" if $err;
20 my $tf = Text::Tradition->new(
22 'file' => 't/data/besoin.xml',
23 'language' => 'French' );
25 is( $tf->language, 'French', "Set language okay" );
27 # Test the lemmatization. How many readings now have morphological info?
28 # Do the lexemes match the reading?
30 foreach my $r ( $tf->collation->readings ) {
32 ok( $r->has_lexemes, "Reading $r has one or more lexemes" );
33 my @lex = $r->lexemes;
34 my $lexstr = join( '', map { $_->string } @lex );
35 my $textstr = $r->text;
37 is( $textstr, $lexstr, "Lexemes for reading $r match the reading" );
38 foreach my $l ( @lex ) {
39 next if $l->is_disambiguated;
40 # printf( "Ambiguous lexeme %s for reading %s:\n\t%s\n", $l->string, $r->id,
41 # join( "\n\t", map { $_->lemma . ': ' . $_->morphology->to_string } $l->matching_forms ) );
45 is( $ambig, 102, "Found 102 ambiguous forms as expected" );
47 # Try setting the normal form of a reading and re-analyzing
48 my $mr = $tf->collation->reading('99,2');
49 is( $mr->text, 'minspire', "Picked correct test reading" );
50 is( $mr->language, 'French', "Reading has correct language setting" );
51 $mr->normal_form( "m'inspire" );
53 is( $mr->lexemes, 2, "Got two lexemes for new m'inspire reading" );