Daniel Perrett > WordLists > WordLists::Inflect::Simple

Download:
WordLists-0.013.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

NAME ^

WordLists::Inflect::Simple

SYNOPSIS ^

        $inflector = WordLists::Inflect::Simple->new;
        $sPlural = $inflector->regular_inflection({w=>'sky', pos=>'n', type=>'plural'});
        $inflector->add_special_case('general');
        $sPlural = $inflector->phrase_inflection({w=>'Director General', pos=>'n', type=>'plural'});

DESCRIPTION ^

This module provides an object which can be used to generate regular and semi-regular English inflections.

By default, it comes with several defaults for semi-regular special cases - dealing with word-final 'e', 'y', and sibilants, dealing with words ending 'man'. This behaviour can be turned on and off.

It deliberately does not deal with irregular forms, even important ones like the verb 'be'. However, it does provide an interface for user-specified irregular inflections, and it is trivial to write a wrapper module (subclass) which loads a pre-written set of inflections.

It does not deal with semi-regular patterns which require knowledge of the behaviour of individual words - for example, there is no reliable way of inspecting 'abet' and discerning that the 't' must be doubled in the present participle. Similarly, there is no attempt made to identify Latin '-us/i' plurals, as this would require making exceptions for words like 'minibus', 'omnibus', and 'octopus'. These must be entered as irregular inflections.

Special Cases

e

Words ending in e, when given inflections like 'ed', 'er', 'est' do not get a second 'e', e.g. blue => bluer, not blue => blueer. Verbs ending in e also lose the e in the present participle, unless the e is preceded by [aeio] (e.g. argue => arguing but see => seeing).

y

Words ending in y, when given 's' inflections or 'e' inflections are subject to a conversion of the 'y' to 'i'/'ie', unless the 'y' is preceded by a vowel, e.g. sky => skies, but day => days.

s

Words ending in sibilants (s, x, sh, ch, z), when given 's' inflections gain an 'e', e.g. 'sash'=>'sashes'.

of

When a phrase of the form X of Y is inflected as a noun, it is X rather than Y which is inflected. This also applies to the pattern X of the Y.

in

When a phrase of the form X in Y is inflected as a noun, it is X rather than Y which is inflected. This also applies to the pattern X in the Y.

general

When a phrase of the form X General is inflected as a noun, it is X rather than General which is inflected.

O'

When a phrase of the form X O'Y is inflected as a noun, it is X rather than Y which is inflected.

man

Nouns ending in 'man' which do not begin with a capital are pluralised 'men' (postman => postmen but German => Germans).

woman

Nouns ending in 'woman' which do not begin with a capital are pluralised 'women'.

person

Nouns ending in 'person' which do not begin with a capital are pluralised 'people'.

child

Nouns ending in 'child' which do not begin with a capital are pluralised 'children'.

-in-law

When a phrase of the form X-in-law is inflected as a noun, it is X rather than -in-law which is inflected.

Miscellaneous notes

There are three parts of speech which can be inflected with this, n, v, and adj.

TODO ^

Improve the accessors for the special cases so a user can query the object for useful special cases to add, specify a fixed list of special cases so new cases don't affect functionality, etc.

Add pos normalisation and an interface for customising the pos normalisation routine.

Document all methods.

BUGS ^

English is buggy. Newspeak is doubleplusgoodlier; consider upgrading.

Some potentially unexpected results may arise, e.g. with 'man' special cased, human is incorrectly pluralised as humen, not the 'more regular' (and correct) humans.

Please use the Github issues tracker for other bugs.

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: