package Search::OpenFTS::Dict::Synonym; use strict; use locale; =head1 NAME Search::OpenFTS::Dict::Synonym - The dictionary of synonym words =head1 SYNOPSIS =cut sub new { my ( $class, %opt ) = @_; $class = ref($class) || $class; my $self = {}; $self->{SYN} = {}; if ( defined $opt{file} ) { open( SYN, $opt{file} ) || die "Can't open $opt{file}"; while () { while (/(\S+)\s+(\S+)/g) { $self->{SYN}{ lc($1) } = lc($2); } } close SYN; } bless( $self, $class ); return $self; } =head2 Methods =over 4 =item lemms( $word ) Returns the list of lexemes for a given word =cut sub lemms { my ( $self, $word ) = @_; $word = lc $word; return $self->{SYN}{$word} if exists $self->{SYN}{$word}; return (); } =head1 SEE ALSO The OpenFTS Primer ( see doc/ subdirectory ) The Crash-course to OpenFTS ( in examples/ subdirectory ) perldoc Search::OpenFTS::Search perldoc Search::OpenFTS::Index perldoc Search::OpenFTS::Parser perldoc Search::OpenFTS::Dict::PorterEng perldoc Search::OpenFTS::Dict::Snowball perldoc Search::OpenFTS::Morph::ISpell =cut 1;