Article View: alt.dcom.telecom
Article #294Re: phonewrd 1.5, patch #1
From: 086236
Date: Tue, 15 Jun 1993 15:20
Date: Tue, 15 Jun 1993 15:20
137 lines
4942 bytes
4942 bytes
In article <1993Jun2.092543.14664@eye.com>, erich@eye.com (Eric Haines) writes...
>Here's the first patch to the phonewrd.c (version 1.5) program (turns phone
>numbers into phrases) posted recently. It makes the program automatically
>widen the search if no match is found initially (thanks to Charles Howe for
>bugging me about this).
>
>Eric
>
>*** phonewrd.15.c Tue Apr 27 14:47:20 1993
>--- phonewrd.c Wed Jun 2 09:22:28 1993
>***************
>*** 2,8 ****
> Phonewrd - given a phone number, find all words or phrases in a dictionary
> which fit it.
>
>! version 1.5 - 4/21/93
>
> (c) copyright 1993, Eric Haines, all rights reserved (erich@eye.com)
>
>--- 2,8 ----
> Phonewrd - given a phone number, find all words or phrases in a dictionary
> which fit it.
>
>! version 1.6 - 6/1/93
>
> (c) copyright 1993, Eric Haines, all rights reserved (erich@eye.com)
>
>***************
>*** 10,15 ****
>--- 10,18 ----
>
> History:
>
>+ 1.6 changes: added "count-up" for number of numerals which stay numerals
>+ (i.e. -n value). We count up until any match is found. Also fixed
>+ dictionary path bug.
> 1.5 changes: added the ability to recognize and expand GNU ispell
> dictionary words. Multiple dictionaries can also be input.
> 1.4 changes: another change in search_for_match to avoid out of bounds
>***************
>*** 303,310 ****
> }
>
> if ( NumDigits > MAX_DIGITS ) {
>! fprintf(stderr, "Sorry, too many digits input in `%s'; ", numeral_string);
>! fprintf(stderr, "only %d allowed.\n", NumDigits);
> USAGE ;
> return(0) ;
> }
>--- 306,314 ----
> }
>
> if ( NumDigits > MAX_DIGITS ) {
>! fprintf(stderr, "Sorry, too many digits input in `%s'; ",
>! numeral_string);
>! fprintf(stderr, "only %d allowed.\n", MAX_DIGITS);
> USAGE ;
> return(0) ;
> }
>***************
>*** 357,369 ****
> if ( word_count ) {
> /* good, there's something to work with: search away! */
> *out_string = '\0' ;
>! search_for_match( 0, out_string, out_string, 0 ) ;
> if ( !MatchTot ) {
> fprintf( stderr,
>! "Bad luck: dictionary words fit, but there's too much numeral goop.\n");
> fprintf( stderr,
>! "I'd try again with the option `-n %d' or so.\n",
>! NumNumerals+1 ) ;
> }
> } else {
> fprintf( stderr,
>--- 361,385 ----
> if ( word_count ) {
> /* good, there's something to work with: search away! */
> *out_string = '\0' ;
>! while ( !MatchTot && ( NumNumerals <= NumDigits ) ) {
>! search_for_match( 0, out_string, out_string, 0 ) ;
>! if ( !MatchTot ) {
>! fprintf( stderr, "No matches with -n %d", NumNumerals ) ;
>! if ( NumNumerals < NumDigits ) {
>! NumNumerals++ ;
>! fprintf( stderr,
>! ", trying again with -n %d\n", NumNumerals ) ;
>! } else {
>! fprintf( stderr, "\n" ) ;
>! }
>! }
>! }
> if ( !MatchTot ) {
> fprintf( stderr,
>! "Bad luck: dictionary words fit, but there's too much numeral goop.\n");
> fprintf( stderr,
>! "Maybe try again with the option `-s abcdgimoptuxy248' or try wildcarding.\n"
>! ) ;
> }
> } else {
> fprintf( stderr,
>***************
>*** 370,376 ****
> "Worst luck: no dictionary words fit anywhere in %s.\n",
> PhoneStr ) ;
> fprintf( stderr,
>! "Maybe try again with the option `-s abcdgimoptuxy248'.\n" ) ;
> }
>
> free_wl() ;
>--- 386,393 ----
> "Worst luck: no dictionary words fit anywhere in %s.\n",
> PhoneStr ) ;
> fprintf( stderr,
>! "Maybe try again with the option `-s abcdgimoptuxy248' or try wildcarding.\n"
>! ) ;
> }
>
> free_wl() ;
>***************
>*** 1228,1235 ****
> free( *DictPath ) ;
> }
> sscanf( argv[num_arg], "%s", str ) ;
>! if ( *str == '.' ) {
>! /* use the default dictionary */
> strcpy( str, DICT_PATH ) ;
> }
> DictPath[DictTot] = str_duplicate( str ) ;
>--- 1245,1252 ----
> free( *DictPath ) ;
> }
> sscanf( argv[num_arg], "%s", str ) ;
>! if ( (str[0] == '.') && ( str[1] == NULL ) ) {
>! /* for '.' use the default dictionary */
> strcpy( str, DICT_PATH ) ;
> }
> DictPath[DictTot] = str_duplicate( str ) ;
Technical Details
Message-ID:
<15JUN199308204158@adpdp2.lanl.gov>Path:
arc1-ca.pugleaf.net!wupost!howland.reston.ans.net!ux1.cso.uiuc.edu!sdd.hp.com!caen!hellgate.utah.edu!lanl!adpdp2.lanl.gov!086236References:
<1993Jun2.092543.14664@eye.com>Show Full Headers
Complete Article Headers
Newsgroups: alt.dcom.telecom,alt.sources Path: arc1-ca.pugleaf.net!wupost!howland.reston.ans.net!ux1.cso.uiuc.edu!sdd.hp.com!caen!hellgate.utah.edu!lanl!adpdp2.lanl.gov!086236 From: 086236@adpdp2.lanl.gov (086236) Subject: Re: phonewrd 1.5, patch #1 Message-ID: <15JUN199308204158@adpdp2.lanl.gov> Summary: automatically widen the search News-Software: VAX/VMS VNEWS 1.41 Sender: news@newshost.lanl.gov Organization: Los Alamos National Laboratory, EMVAX References: <1993Jun2.092543.14664@eye.com> Date: Tue, 15 Jun 1993 15:20:00 GMT Lines: 137