File: 06-analyze.t

package info (click to toggle)
libtext-hunspell-perl 2.11-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 176 kB
  • ctags: 381
  • sloc: cpp: 789; perl: 34; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 722 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use strict;
use warnings;

use Data::Dumper;
use Test::More tests => 7;
use Text::Hunspell;

my $speller = Text::Hunspell->new(qw(./t/test.aff ./t/test.dic));
ok($speller, qq(Created a Text::Hunspell object [$speller]));

# Sample analysis:
#
#    'st:ló po:noun ts:NOM al:lovak is:ABL'
#
my $word = q(lótól);
my $analysis = $speller->analyze($word);

ok($analysis, q(Got something back));
diag("Analysis result: [$analysis]");

# I'm a total newbie in dictionary stuff
ok($analysis =~ m{st:ló}, q(Stemming root));
ok($analysis =~ m{po:noun}, q(Word supposed to be a noun));
ok($analysis =~ m{ts:NOM}, q(Have no idea));
ok($analysis =~ m{al:lovak}, q(Also here, no idea));
ok($analysis =~ m{is:ABL}, q(Guess what?));