NAME
Lingua::EN::ABC - American, British, and Canadian English
SYNOPSIS
use Lingua::EN::ABC ':all';
my $colour = a2b ('color');
DESCRIPTION
This module offers functions to convert between the spellings and vocabulary of American, British, and Canadian versions of English.
FUNCTIONS
The naming convention for the functions is "a" for American, "b" for British, "c" for Canadian, so "a2b" converts "American to British".
a2b
my $british = a2b ('color');
# $british = 'colour'.
Convert American into British spellings. An option oxford
controls whether to use Oxford spelling (realize rather than realise):
my $oxford_british = a2b ('realize', oxford => 1);
This cannot correctly convert ambiguous spellings like "program", which may be either "program" or "programme" in British English. See "BUGS". It tries to convert American formations like "gotten" into "got".
b2a
my $american = b2a ('the colour of my pyjamas');
# $american = 'the color of my pajamas'
Convert British spellings into American spellings. This cannot convert British formations like "got" into "gotten" due to the grammatical ambiguity ("I've got a car" versus "I've gotten into an accident", or "I got into an accident").
a2c
my $canadian = a2c ('the color');
# $canadian = 'the colour'
Convert American to Canadian spelling.
c2a
my $american = c2a ('the color');
# $american = 'the colour'
Convert Canadian to American spelling.
b2c
my $canadian = b2c ('the programme');
# $canadian = 'the program'
Convert British to Canadian spelling.
c2b
my $british = c2b ($canadian);
Convert Canadian to British spelling. An option oxford
controls whether to use Oxford spelling (realize rather than realise):
my $oxford_british = c2b ($canadian, oxford => 1);
DEPENDENCIES
- boolean
-
boolean is used for making the JSON. It isn't required to use the module, only if you need to edit it. See also "BUILD PROCESS".
- Carp
-
Carp is used to print errors.
- JSON::Create
-
JSON::Create is used for making the JSON. It isn't required to use the module, only if you need to edit it. See also "BUILD PROCESS".
- JSON::Parse
-
JSON::Parse is used to read in the file of spelling data. This file isn't intended to be human-edited, please edit abc.txt in the top directory of the distribution.
SEE ALSO
- Lingua::EN::ABC::Data
-
This is the underlying data for this module, put into POD format so that it's easy to search and check.
- respell
-
respell is a tool to convert English text from one spelling system to another.
STANDALONE SCRIPT
There is a script called econv in the distribution which runs these functions on its command line. Please use econv --help
for detailed usage instructions.
BUILD PROCESS
The file containing the spelling variations is abc.txt in the top directory of the distribution. The comment at the top of the file contains information about the format. If you want to add to this module's list of words, please edit the file abc.txt and send a pull request on github. Unfortunately the build process uses two private modules. One is called Table::Readable and the other one is called Perl::Build (this actually predates the module called Perl::Build on CPAN by TOKUHIROM), so it's hard to build. However, if you are interested in working on this module, but do not want to adopt it, please let me know, and I will remove the dependence on these two private modules. If you want to adopt the module then please contact me at bkb@cpan.org.
BUGS
- No handling of ambiguous words like "program".
- Cannot convert case-insensitively.
- Word lists are not comprehensive
- The module's methodology is very far from efficient, so for very long texts this module may perform very badly.
- There are no tests involving the ambiguity data
-
Up to version 0.05 of the module, the ambiguity data about which words are ambiguous (vice/vise etc.) was not being put into the JSON data file, and yet it was passing all its tests, so there cannot be any tests of this.
ACKNOWLEDGEMENTS
A list of words at http://en.wikipedia.org/wiki/User:Ohconfucius/U.S._Spelling_versus_British_and_Canadian_Spellings, by Wikipedia user Ohconfucius, was used in the preparation of the data.
HISTORY
This module was originally part of a plan to make an online thesaurus. However, I have shut down the online thesaurus, so I do not have a practical need for this module any more. If you want to adopt this module so that you can improve it, please contact me at bkb@cpan.org.
AUTHOR
Ben Bullock, <bkb@cpan.org>
Request
If you'd like to see this module continued, let me know that you're using it. For example, send an email, write a bug report, star the project's github repository, add a patch, add a ++
on Metacpan.org, or write a rating at CPAN ratings. It really does make a difference. Thanks.
COPYRIGHT & LICENCE
This package and associated files are copyright (C) 2013-2015 Ben Bullock.
You can use, copy, modify and redistribute this package and associated files under the Perl Artistic Licence or the GNU General Public Licence.
TERMINOLOGY
This defines the terminology used in this document.
- Convenience function
-
In this document, a "convenience function" indicates a function which solves some of the problems, some of the time, for some of the people, but which may not be good enough for all envisaged uses. A convenience function is an 80/20 solution, something which solves (about) 80% of the problems with 20% of the effort. Something which does the obvious things, but may not do all the things you might want, a time-saver for the most basic usage cases.
- BUGS
-
In this document, the section BUGS describes possible deficiencies, problems, and workarounds with the module. It's not a guide to bug reporting, or even a list of actual bugs. The name "BUGS" is the traditional name for this sort of section in a Unix manual page.