⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 t9.pm

📁 T9 Text Input You can use this source code for input T9 Text Input(English)
💻 PM
字号:
#!/usr/bin/perlpackage Text::T9;use Exporter;our @ISA = qw( Exporter );our @EXPORT = qw( t9_find_words );our $VERSION = '1.0';use strict;use warnings;use Carp;our @T9NL = ( '', '', 'ABC', 'DEF', 'GHI', 'JKL', 'MNO', 'PQRS', 'TUV', 'WXYZ' );sub t9_find_words($$){  my $num = shift;  my $words = shift;    return () unless $num =~ /^[2-9]+$/;    my $len = length( $num );  my $re;  for( 0 .. $len - 1 )    {    $re .= "[" . $T9NL[substr( $num, $_, 1 )] . "]";    }  $re = "^$re\$";  return grep { /$re/i } grep { length( $_ ) == $len } @$words;}=pod=head1 NAMEText::T9 - Text in 9 keys (T9) input.=head1 SYNOPSIS  # array with words  my @words = qw( this is just a simple kiss test lips here how );    # what is word(s) for the sequence   print "$_ " for( t9_find_words( 5477, \@words ) );    # this prints: kiss lips=head1 DESCRIPTIONWhat is T9 Text Input?T9 Text Input is software that enables users to easily enter text into small devices with limited size keyboards, like mobile phones. T9 Text Input replaces the traditional "multi-tap" method of entering text providing the ability to enter text using only one keystroke per letter.(you can find more inforation at http://www.t9.com/)This module provides simple way to find which words match a numbersequence in T9 sense.Examples:  5477   : KISS, LIPS   8447   : THIS   746753 : SIMPLE   469    : HOW Allowed number are 2,3,4,5,6,7,8,9 which are mapped in this way:  2 ABC  3 DEF  4 GHI  5 JKL  6 MNO  7 PQRS  8 TUV  9 WXYZ=over 4=item t9_find_words( $num, \@words_arr )This functions takes two arguments: number sequence and words array reference. The return value is a list of matching words.=back=head1 EXAMPLES  open( i, "/tmp/words.lst" );  @words = <i>;  close( i );  chomp( @words );  print "$#words were loaded\n";    for my $num ( qw( 5477 8447 746753 469 ) )    {    print "$num: ";    print "$_ " for( t9_find_words( $num, \@words ) );    print "\n";    }=head1 AUTHOR  Vladi Belperchinov-Shabanski "Cade"                                       <cade@biscom.net> <cade@datamax.bg> <cade@cpan.org>  http://www.biscom.net/~cade=cut

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -