Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,30 @@
/*REXX program finds words with the largest set of anagrams (of the same size). */
iFID= 'unixdict.txt' /*the dictionary input File IDentifier.*/
$=; !.=; ww=0; uw=0; most=0 /*initialize a bunch of REXX variables.*/
/* [↓] read the entire file (by lines)*/
do while lines(iFID) \== 0 /*Got any data? Then read a record. */
parse value linein(iFID) with @ . /*obtain a word from an input line. */
len=length(@); if len<3 then iterate /*onesies and twosies words can't win. */
if \datatype(@, 'M') then iterate /*ignore any non─anagramable words. */
uw=uw + 1 /*count of the (useable) words in file.*/
_=sortA(@) /*sort the letters in the word. */
!._=!._ @; #=words(!._) /*append it to !._; bump the counter. */
if #==most then $=$ _ /*append the sorted word──► max anagram*/
else if #>most then do; $=_; most=#; if len>ww then ww=len; end
end /*while*/ /*$ ◄── list of high count anagrams. */
say '' uw "usable words in the dictionary file: " iFID
say
do m=1 for words($); z=subword($, m, 1) /*the high count of the anagrams. */
say ' ' left(word(!.z, 1), ww) ' [anagrams: ' subword(!.z, 2)"]"
end /*m*/ /*W is the maximum width of any word.*/
say
say ' Found' words($) "words (each of which have" words(!.z)-1 'anagrams).'
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
sortA: arg char 2 xx,@. /*get the first letter of arg; @.=null*/
@.char=char /*no need to concatenate the first char*/
/*[↓] sort/put letters alphabetically.*/
do length(xx); parse var xx char 2 xx; @.char=@.char || char; end
/*reassemble word with sorted letters. */
return @.a || @.b || @.c || @.d || @.e || @.f||@.g||@.h||@.i||@.j||@.k||@.l||@.m||,
@.n || @.o || @.p || @.q || @.r || @.s||@.t||@.u||@.v||@.w||@.x||@.y||@.z

View file

@ -0,0 +1,30 @@
/*REXX program finds words with the largest set of anagrams (of the same size). */
iFID= 'unixdict.txt' /*the dictionary input File IDentifier.*/
$=; !.=; ww=0; uw=0; most=0 /*initialize a bunch of REXX variables.*/
/* [↓] read the entire file (by lines)*/
do while lines(iFID) \== 0 /*Got any data? Then read a record. */
parse value linein(iFID) with @ . /*obtain a word from an input line. */
len=length(@); if len<3 then iterate /*onesies and twosies words can't win. */
if \datatype(@, 'M') then iterate /*ignore any non─anagramable words. */
uw=uw + 1 /*count of the (useable) words in file.*/
_=sortA(@) /*sort the letters in the word. */
!._=!._ @; #=words(!._) /*append it to !._; bump the counter. */
if #==most then $=$ _ /*append the sorted word──► max anagram*/
else if #>most then do; $=_; most=#; if len>ww then ww=len; end
end /*while*/ /*$ ◄── list of high count anagrams. */
say '' uw "usable words in the dictionary file: " iFID
say
do m=1 for words($); z=subword($, m, 1) /*the high count of the anagrams. */
say ' ' left(word(!.z, 1), ww) ' [anagrams: ' subword(!.z, 2)"]"
end /*m*/ /*W is the maximum width of any word.*/
say
say ' Found' words($) "words (each of which have" words(!.z)-1 'anagrams).'
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
sortA: arg char 2 xx,@. /*get the first letter of arg; @.=null*/
@.char=char /*no need to concatenate the first char*/
/*[↓] sort/put letters alphabetically.*/
do length(xx); parse var xx char 2 xx; @.char=@.char || char; end
/*reassemble word with sorted letters. */
return @.a || @.b || @.c || @.d || @.e || @.f||@.g||@.h||@.i||@.j||@.k||@.l||@.m||,
@.n || @.o || @.p || @.q || @.r || @.s||@.t||@.u||@.v||@.w||@.x||@.y||@.z

View file

@ -0,0 +1,23 @@
u= 'Halloween' /*word to be sorted by (Latin) letter.*/
upper u /*fast method to uppercase a variable. */
/*another: u = translate(u) */
/*another: parse upper var u u */
/*another: u = upper(u) */
/*not always available [↑] */
say 'u=' u
_.=
do until u=='' /*keep truckin' until U is null. */
parse var u y +1 u /*get the next (first) character in U.*/
xx='?'y /*assign a prefixed character to XX. */
_.xx=_.xx || y /*append it to all the Y characters. */
end /*until*/ /*U now has the first character elided.*/
/*Note: the variable U is destroyed.*/
/* [↓] constructs a sorted letter word*/
z=_.?a||_.?b||_.?c||_.?d||_.?e||_.?f||_.?g||_.?h||_.?i||_.?j||_.?k||_.?l||_.?m||,
_.?n||_.?o||_.?p||_.?q||_.?r||_.?s||_.?t||_.?u||_.?v||_.?w||_.?x||_.?y||_.?z
/*Note: the ? is prefixed to the letter to avoid */
/*collisions with other REXX one-character variables.*/
say 'z=' z

View file

@ -0,0 +1,18 @@
u= 'Halloween' /*word to be sorted by (Latin) letter.*/
upper u /*fast method to uppercase a variable. */
L=length(u) /*get the length of the word (in bytes)*/
say 'u=' u
say 'L=' L
_.=
do k=1 for L /*keep truckin' for L characters. */
parse var u =(k) y +1 /*get the Kth character in U string.*/
xx='?'y /*assign a prefixed character to XX. */
_.xx=_.xx || y /*append it to all the Y characters. */
end /*do k*/ /*U now has the first character elided.*/
/* [↓] construct a sorted letter word.*/
z=_.?a||_.?b||_.?c||_.?d||_.?e||_.?f||_.?g||_.?h||_.?i||_.?j||_.?k||_.?l||_.?m||,
_.?n||_.?o||_.?p||_.?q||_.?r||_.?s||_.?t||_.?u||_.?v||_.?w||_.?x||_.?y||_.?z
say 'z=' z

View file

@ -0,0 +1,61 @@
/*REXX program finds words with the largest set of anagrams (same size)
* 07.08.2013 Walter Pachl
* sorta for word compression courtesy Gerard Schildberger,
* modified, however, to obey lowercase
* 10.08.2013 Walter Pachl take care of mixed case dictionary
* following Version 1's method
**********************************************************************/
Parse Value 'A B C D E F G H I J K L M N O P Q R S T U V W X Y Z',
With a b c d e f g h i j k l m n o p q r s t u v w x y z
Call time 'R'
ifid='unixdict.txt' /* input file identifier */
words=0 /* number of usable words */
maxl=0 /* maximum number of anagrams */
wl.='' /* wl.ws words that have ws */
Do ri=1 By 1 While lines(ifid)\==0 /* read each word in file */
word=space(linein(ifid),0) /* pick off a word from the input.*/
If length(word)<3 Then /* onesies and twosies can't win. */
Iterate
If\datatype(word,'M') Then /* not an anagramable word */
Iterate
words=words+1 /* count of (useable) words. */
ws=sorta(word) /* sort the letters in the word. */
wl.ws=wl.ws word /* add word to list of ws */
wln=words(wl.ws) /* number of anagrams with ws */
Select
When wln>maxl Then Do /* a new maximum */
maxl=wln /* use this */
wsl=ws /* list of resulting ws values */
End
When wln=maxl Then /* same as the one found */
wsl=wsl ws /* add ws to the list */
Otherwise /* shorter */
Nop /* not yet of interest */
End
End
Say ' '
Say copies('-',10) ri-1 'words in the dictionary file: ' ifid
Say copies(' ',10) words 'thereof are anagram candidates'
Say ' '
Say 'There are' words(wsl) 'set(s) of anagrams with' maxl,
'elements each:'
Say ' '
Do while wsl<>''
Parse Var wsl ws wsl
Say ' 'wl.ws
End
Say time('E')
Exit
sorta:
/**********************************************************************
* sort the characters in word_p (lowercase translated to uppercase)
* 'chARa' -> 'AACHR'
**********************************************************************/
Parse Upper Arg word_p
c.=''
Do While word_p>''
Parse Var word_p cc +1 word_p
c.cc=c.cc||cc
End
Return c.a||c.b||c.c||c.d||c.e||c.f||c.g||c.h||c.i||c.j||c.k||c.l||,
c.m||c.n||c.o||c.p||c.q||c.r||c.s||c.t||c.u||c.v||c.w||c.x||c.y||c.z