Textonyms: Difference between revisions

Content added Content deleted
m (added related tasks.)
m (→‎{{header|REXX}}: split a long statement into two lines, added/changed whitespace, added a blank line to the output.)
Line 2,366: Line 2,366:


do while lines(iFID)\==0; x= linein(iFID) /*keep reading the file until exhausted*/
do while lines(iFID)\==0; x= linein(iFID) /*keep reading the file until exhausted*/
y= x; upper x /*save a copy of X; uppercase X. */
y= x; upper x /*save a copy of X; uppercase X. */
if \datatype(x, 'U') then do; ills=ills + 1; iterate; end /*Not legal? Skip.*/
if \datatype(x, 'U') then do; ills= ills + 1; iterate; end /*Not legal? Skip.*/
if $.x==. then do; dups=dups + 1; iterate; end /*Duplicate? Skip.*/
if $.x==. then do; dups= dups + 1; iterate; end /*Duplicate? Skip.*/
$.x= . /*indicate that it's a righteous word. */
$.x= . /*indicate that it's a righteous word. */
#word= #word + 1 /*bump the word count (for the file). */
#word= #word + 1 /*bump the word count (for the file). */
Line 2,375: Line 2,375:
!.z= !.z y; _= words(!.z) /*build list of equivalent digit key(s)*/
!.z= !.z y; _= words(!.z) /*build list of equivalent digit key(s)*/


if _>most then do; mostus=z; most=_; end /*remember the "mostus" digit keys. */
if _>most then do; mostus= z; most= _; end /*remember the "mostus" digit keys. */


if @.z==2 then do; #= # + 1 /*bump the count of the textonyms. */
if @.z==2 then do; #= # + 1 /*bump the count of the textonyms. */
Line 2,387: Line 2,387:
if @.z==1 then digKey= digKey + 1 /*bump the count of digit key words. */
if @.z==1 then digKey= digKey + 1 /*bump the count of digit key words. */
end /*while*/
end /*while*/

@dict= 'in the dictionary file' /*literal used for some displayed text.*/
@dict= 'in the dictionary file' /*literal used for some displayed text.*/
L= length(commas(max(#word,ills,dups,digKey,#))) /*find length of max # being displayed.*/
L= length(commas(max(#word,ills,dups,digKey,#))) /*find length of max # being displayed.*/
say 'The dictionary file being used is: ' iFID
say 'The dictionary file being used is: ' iFID
say
call tell #word, 'words' @dict "which can be represented by digit key mapping"
if ills>0 then call tell ills, 'word's(ills) "that contain illegal characters" @dict
call tell #word, 'words' @dict,
"which can be represented by digit key mapping"
if dups>0 then call tell dups, 'duplicate word's(dups) "detected" @dict
if ills>0 then call tell ills, 'word's(ills) "that contain illegal characters" @dict
if dups>0 then call tell dups, 'duplicate word's(dups) "detected" @dict
call tell digKey, 'combination's(digKey) "required to represent them"
call tell digKey, 'combination's(digKey) "required to represent them"
call tell #, 'digit combination's(#) "that can represent Textonyms"
call tell #, 'digit combination's(#) "that can represent Textonyms"
say
say; if first\==. then say ' first digit key=' !.first
if last\==. then say ' last digit key=' !.last
if first \== . then say ' first digit key=' !.first
if long\==0 then say ' longest digit key=' !.long
if last \== . then say ' last digit key=' !.last
if most\==0 then say ' numerous digit key=' !.mostus " ("most 'words)'
if long \== 0 then say ' longest digit key=' !.long
if most \== 0 then say ' numerous digit key=' !.mostus " ("most 'words)'
exit # /*stick a fork in it, we're all done. */
exit # /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
/*──────────────────────────────────────────────────────────────────────────────────────*/
Line 2,408: Line 2,412:
<pre>
<pre>
The dictionary file being used is: UNIXDICT.TXT
The dictionary file being used is: UNIXDICT.TXT

There are 24,978 words in the dictionary file which can be represented by digit key mapping.
There are 24,978 words in the dictionary file which can be represented by digit key mapping.
There are 126 words that contain illegal characters in the dictionary file.
There are 126 words that contain illegal characters in the dictionary file.
Line 2,422: Line 2,427:
<pre>
<pre>
The dictionary file being used is: TEXTONYMS.TXT
The dictionary file being used is: TEXTONYMS.TXT

There are 12,990 words in the dictionary file which can be represented by digit key mapping.
There are 12,990 words in the dictionary file which can be represented by digit key mapping.
There are 95 duplicate words detected in the dictionary file.
There are 95 duplicate words detected in the dictionary file.