NAME

Lingua::Jspell::DictManager - a perl module for processing jspell dictionaries

SYNOPSIS

use Lingua::Jspell::DictManager;

$dict = init("dictionary file");

$dict->foreach_word( \&func );

$dict->for_this_cat_I_want_only_these_flags('nc', 'fp');

$dict->add_flag("p","linha","carro",...);

$dict->add_word({word=>'word',flags=>'zbr',CAT=>'np',G=>'f'},...)

remflag("f.dic","p","linha","carro",...);

DESCRIPTION

init

This function returns a new dictionary object to be used in future methods. It requires a string with the dictionary file name.

install_dic

install_dic({name=>"teste"} ,"t.aff", "t.dic")
install_dic({name=>"t"} ,"from:port", "t1.dic", "t2.dic")
install_dic({yaml=>"t.yaml"} ,"from:port", "t1.dic", "t2.dic")
install_dic({yaml=>"t.yaml",irr=>"f.irr"} ,"from:port", "t1.dic")

from:lang is used to reuse the affix table from language lang (the file lang.aff is imported from the jspell library directory. (see jspell-dic -dir)

name  -- name of the dictionary
yaml  -- yaml file with metadata
irr   -- file with irregular terms

foreach_word

This method processes all words from the dictionary using the function passed as argument. This function is called with three arguments: the word, a reference to an associative array with the category information and a reference to a list of rules identifiers.

modeach_word

This method processes all words from the dictionary using the function passed as argument. This function is called with three arguments: the word, a reference to an associative array with the category information and a reference to a list of rules identifiers.

If the option rawfea =>1 is selected, modeach_word receives a string instead of a hash reference.

modeach_word({rawfea=>1}, sub { my($w,$cat,$flags,@com)=@_; ... })

Use the function toword($word,$fea,$flag,$coms) to rebuild a new value; if "" is return, the previous value is kept.

for_this_cat_I_want_only_these_flags

This method receives a gramatical category and a string with flags. It will print warning messages for each entry with that category and with a flag not described in the flags string.

for_this_cat_I_dont_want_these_flags

Works like the previous method, but will print warnings if any category uses one of the specificed flags.

not_categorized

This method returns a report for the entries without a category definition.

extra_words

This method tries to find redundant entries on the dictionary, producing an ouput file to be executed and delete the redundancy.

add_word

Add (one or more) word to the dictionary

$dict->add_word({word=>'word',flags=>'zbr',CAT=>'np',G=>'f'},...)

delete_word

Deletes the word passed as argument.

add_flag

Adds the flags in the first argument to all words passed.

toword

to format Word, features, flags and commants to jspell-dict format. This functions is tically used em modeach_word.

AUTHOR

Alberto Simoes, E<lt>albie@alfarrabio.di.uminho.ptE<gt>

J.Joao Almeida, E<lt>jj@di.uminho.ptE<gt>

SEE ALSO

Lingua::Jspell(3), jspell(1)

COPYRIGHT & LICENSE

Copyright 2007-2009 Projecto Natura

This program is free software; licensed under GPL.