- printthem Input: the output of to_words (a href) Output: displays some of the data in a table
- printvalids Helper function for printthem() Input: the hash ref Output: a stings
- to_words Input: a string, like '703-111-2628', and an optional search timeout Output: sorted set of dictionary words that correspond to the tel number substrings
- to_num Translates a mnemonic tel number to digits Input: an alphanumeric sting, like '(g03) verison' Output: a string like, like '(703) 232 3333'
- SEE ALSO
- COPYRIGHT AND LICENSE
Telephone::Mnemonic::US - Maps US telephone numbers from mnemonic 'easy-to-remember' words to digits, it can also attempts the reverse and maps telephone digits to mnemonic words.
to_words Input: a string, like '703-111-2628', and an optional search timeout Output: sorted set of dictionary words that correspond to the tel number substrings
to_num Translates a mnemonic tel number to digits Input: an alphanumeric sting, like '(g03) verison' Output: a string like, like '(703) 232 3333'
use Telephone::Mnemonic::US qw/ to_words to_num /; to_words('(263) 748 7233'); => ameritrade assuming it was n the dictionary to_words('(263) 748 7233',9); => ameritrade but might timeout after 9 sec of searching to_num('ameritrade') ; => (263) 748 7233
The to_num function converts (a well formed ) telephone mnemonic to digits, returns undef on failure. A well formed US number must be something reasonable, it should contain either 7, or 10 digits. You can supply it in many format,i.g. 703.verison, verison, gotverison, or got-ver-ison. On success, you receive a string such as '(703) 123 4567'
The to_words function converts (a well formatted) telephone number to one or more mnemonics. Unless you lucky to receive one dictionary word that maps to a 10-digit number, as partial match, you will probably receive several answers, with each answer matching one or two dictionary words. If you requested a match for telephone number '(703) 404 2628', some answers are bound to include the words 'boat', 'coat', and 'anat' as partial match for the last 4 digits. An optional parameter can serve as search timeout. On success it returns a hash reference containing all possible answers or partial segments; you could also use the printthem function to display them.
It understands telephone numbers in many formants; numbers without area code or with mixture of letters and digits are possible but it is best to stick with the formats supported by Number::Phone .
The Dictionary must be located at /usr/share/dict/words or at /usr/dict/words with words in dictionary order.
None by default.
If you have a mailing list set up for your module, mention it here.
If you have a web site set up for your module, mention it here.
Ioannis Tambouras <firstname.lastname@example.org>
Copyright (C) 2011 by Ioannis Tambouras
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.1 or, at your option, any later version of Perl 5 you may have available.