NAME
Lingua::Word2Num - Word to number conversion
VERSION
version 0.2603260
Lingua::Word2Num is a module for converting texts in their spoken language representation into numbers. This is wrapper for various Lingua::XXX::Word2Num modules. Input text must be in utf8 encoding.
For further information about various limitations see documentation for currently used package.
SYNOPSIS
use Lingua::Word2Num;
my $words = Lingua::Word2Num->new;
# convert Czech text to number
my $number = $words->cardinal( 'cs', 'sto dvacet' );
# or procedural usage
my $number = Lingua::Word2Num::cardinal( 'de', 'zweiundvierzig');
print $number // "sorry, can't convert this text into a number.";
Functions Reference
- cardinal (positional)
-
1 str language code 2 str text to convert => num converted number => undef if the input string is not knownConversion from a text in the specified language into a number.
- known_langs (void)
-
=> lref list of known languagesList of all currently supported languages.
- new (void)
-
=> obj returns new objectConstructor.
- preprocess_code (void)
-
=> str returns a templatePrivate.
EXPORT_OK
- cardinal
- known_langs
- langs
Required modules
This module is only wrapper and requires other CPAN modules for requested conversions eg. Lingua::AFR::Numbers for Afrikaans.
Currently supported languages/modules are:
- afr - Lingua::AFR::Word2Num
- ces - Lingua::CES::Word2Num
- deu - Lingua::DEU::Word2Num
- eng - Lingua::ENG::Word2Num
- eus - Lingua::EUS::Word2Num
- fra - Lingua::FRA::Word2Num
- ind - Lingua::IND::Words2Nums
- ita - Lingua::ITA::Word2Num
- jpn - Lingua::JPN::Word2Num
- nld - Lingua::NLD::Word2Num
- nor - Lingua::NOR::Word2Num
- pol - Lingua::POL::Word2Num
- por - Lingua::POR::Words2Nums
- rus - Lingua::RUS::Word2Num
- spa - Lingua::SPA::Word2Num
- swe - Lingua::SWE::Word2Num
- zho - Lingua::ZHO::Word2Num
AUTHORS
specification, maintenance:
Richard C. Jelinek E<lt>rj@petamem.comE<gt>
coding (until 2005):
Roman Vasicek E<lt>info@petamem.comE<gt>
maintenance, coding (2025-present):
PetaMem AI Coding Agents
COPYRIGHT
Copyright (c) PetaMem, s.r.o. 2004-present
LICENSE
This module is free software; you can redistribute it and/or modify it under the same terms as the Artistic License 2.0 or the BSD 2-Clause License. See the LICENSE file in the distribution for details.