Daniel Perrett > WordLists-0.013 > WordLists::WordList

Download:
WordLists-0.013.tar.gz

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

NAME ^

WordLists::WordList

SYNOPSIS ^

        my $wl = WordLists::WordList->new({from_file=>'unit1.txt'});
        my @senses = $wl->get_senses_for('book', 'verb');
        $wl->add_sense($new_sense);
        print OUT $wl->to_string;

DESCRIPTION ^

WordLists::WordList is a base class for a group of WordLists::Sense objects.

new

The constructor creates an empty wordlist, and will populate the wordlist if you pass it parameters such as from_string and from_file (in which case, you can also specify encoding). These parameters should be passed in a hash ref (as per the example in the synopsis). You can populate the wordlist later, of course.

parser

This is an accessor for the parser, and returns the parser and/or sets the parser if given one. The parser defaults to WordLists::Parse::Simple, and the parser is created the first time it is requested (not when the WordLists::WordList object is created, unless from_file or from_string is used).

serialiser

This is an accessor for the serialiser, and returns the serialiser and/or sets the serialiser if given one. The serialiser defaults to WordLists::Serialise::Simple, and the serialiser is created the first time it is requested (not when the WordLists::WordList object is created).

get_senses_for

This returns senses which match the parameters specified (hw, pos).

get_all_senses

This returns all senses; by default, it will return them in the order in which they were entered, but senses can be reordered using the sort method.

TODO ^

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.

syntax highlighting: