Parse::Number::ID - Parse number from Indonesian text
This document describes version 0.08 of Parse::Number::ID (from Perl distribution Parse-Number-ID), released on 2015-09-03.
use Parse::Number::ID qw(parse_number_id); my @a = map {parse_number_id(text=>$_)} ("12.345,67", "-1,2e3", "x123", "1.23"); # @a = (12345.67, -1200, undef, 1.23)
The goal of this module is to parse/extract numbers commonly found in Indonesian text. It currently parses numbers according to Indonesian rule of decimal- and thousand separators ("," and "." respectively) as well as English ("." and ","), since English numbers are more widespread and sometimes mixed within.
12.3 # 12.3 12.34 # 12.34 12.345 # 12345
In the future this module might also parse fractions (e.g. 1/3, 2 1/2) and percentages (e.g. 1,2%).
This module does not parse numbers that are written as Indonesian words, e.g. "seratus dua puluh tiga" (123). See Lingua::ID::Words2Nums and Regexp::ID::NumVerbage for that.
Parse number from Indonesian text.
Arguments ('*' denotes required arguments):
text* => str
The input text that contains number.
Return value: (any)
None are exported by default, but they are exportable.
A regex for quickly matching/extracting number from text. It's not 100% perfect (the extracted number might not be valid), but it's simple and fast.
This module uses a single regex and provides the regex for you to use. Other modules might be more accurate and/or faster. But this module is pretty fast.
Also, since English text are often found in Indonesian text, parsing English numbers (which uses periods for decimals and commas for thousand separators instead of the other way around) is also done, as long as it is not ambiguous.
Lingua::ID::Words2Nums
Please visit the project's homepage at https://metacpan.org/release/Parse-Number-ID.
Source repository is at https://github.com/perlancar/perl-Parse-Number-ID.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Parse-Number-ID
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
perlancar <perlancar@cpan.org>
This software is copyright (c) 2015 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Parse::Number::ID, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parse::Number::ID
CPAN shell
perl -MCPAN -e shell install Parse::Number::ID
For more information on module installation, please visit the detailed CPAN module installation guide.