Text::Math::NumExp - Text::Math::NumExp - Find numeric expressions in text.
version 0.01_12
use Text::Math::NumExp; my $text = "Light travels at 3x10[8] m/s." norm_numexp($text); # "Light travels at 3x10^8 m/s." $text = "The program used for the amplification was as follows: 5 min at 94°C, followed by 50 cycles consisting of 30s at 94°C, 30s at 62°C, and 30s at 72°C"; find_numexp($text); # [ { length => 1, offset => 54, text => 5, value => 5 }, # { length => 2, offset => 63, text => 94, value => 94 }, # { length => 2, offset => 81, text => 50, value => 50 }, # { length => 9, offset => 105, text => "30s at 94", value => undef }, # { length => 9, offset => 119, text => "30s at 62", value => undef }, # { length => 9, offset => 137, text => "30s at 72", value => undef }, # ] $text = "One plus one equals two."; find_numwords($text); # [ { length => 3, offset => 0, text => "One", value => 1 }, # { length => 3, offset => 9, text => "one", value => 1 }, # { length => 3, offset => 20, text => "two", value => 2 }, # ]
This module searches for numbers and numeric expressions in a text, including:
Finds numeric expressions in text.
Finds spelled-out numbers in text.
Returns the value of a numerical expression. Retuns undef if expression is not solvable.
Normalizes common numerical expression patterns (including Unicode characters).
Andre Santos <andrefs@cpan.org>
This software is copyright (c) 2012 by Andre Santos.
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 Text::Math::NumExp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::Math::NumExp
CPAN shell
perl -MCPAN -e shell install Text::Math::NumExp
For more information on module installation, please visit the detailed CPAN module installation guide.