The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WordLists::Tag::Tagger

SYNOPSIS

        my $tagger = WordLists::Tag::Tagger->new();
        my $wl = $tagger->get_wordlist('The quick brown fox jumped over the lazy dog');

DESCRIPTION

Uses Lingua::EN::Tagger to do various things with strings, chielfly to create a WordLists::WordList out of a document, e.g. to use as a basis for a glossary.

METHODS

get_wordlist

Uses Lingua::EN::Tagger to create a WordLists::WordList out of a string (e.g. a manuscript).

Lingua::EN::Tagger allows splitting into sentences, and these sentences become eg fields in the WordLists::Senses generated.

Only the first instance of each headword / part of speech combination is entered into the list, unless the third argument has a key keep_repeats with a true value.

The fields populated are: hw, pos, eg, and poscode, which is the original part of speech code outputted by the tagger.

The third argument is a hashref which allows you to configure several options.

callback_on_add_sense should be a coderef. It is passed the sense immediately before it is added to the wordlist, e.g. if you want to add a unit.

callback_on_make_sense should be a coderef. It is passed the sense before the wordlist is tested for inclusion. This is an opportunity to further normalise parts of speech.

keep_repeats is a flag, which, if set, prevents the code from removing repetitions.

TODO

ignore is a wordlist or arrayref whose elements are WordLists::Sense objects or plain hashrefs of the form {hw=>'head', pos =>'n'}, or headwords as strings. If these words are found, they are not added to the list. (not yet implemented!)

BUGS

Please use the Github issues tracker.

LICENSE

Copyright 2011-2012 © Cambridge University Press. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.