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?
31 foreach my $r ( $tf->collation->readings ) {
33 ok( $r->has_lexemes, "Reading $r has one or more lexemes" );
34 my @lex = $r->lexemes;
35 my $lexstr = join( '', map { $_->string } @lex );
36 my $textstr = $r->text;
38 is( $textstr, $lexstr, "Lexemes for reading $r match the reading" );
39 foreach my $l ( @lex ) {
40 # Check to see if Flemm actually ran
41 foreach my $wf ( $l->matching_forms ) {
42 $flemmed++ if $wf->morphology->get_feature('num');
44 next if $l->is_disambiguated;
48 is( $ambig, 102, "Found 102 ambiguous forms as expected" );
49 ok( $flemmed > 500, "Found enough Flemm info in wordforms" );
51 # Try setting the normal form of a reading and re-analyzing
52 my $mr = $tf->collation->reading('r99.2');
53 is( $mr->text, 'minspire', "Picked correct test reading" );
54 is( $mr->language, 'French', "Reading has correct language setting" );
55 $mr->normal_form( "m'inspire" );
58 is( @l, 2, "Got two lexemes for new m'inspire reading" );
59 is( $l[0]->form->to_string,
60 '"French // se|le|lui // cat@pron type@pers pers@1 num@sing case@acc|dat"',
61 "New reading has correct first lexeme" );