Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,42 +1,41 @@
/*REXX program counts the occurrences of all characters in a file, and note that all */
/* Latin alphabet letters are uppercased for also counting {Latin} letters (both cases).*/
/*════════════════════════════════════~~~~~~~~~~════════════════════════════════════════*/
abc = 'abcdefghijklmnopqrstuvwxyz' /*define an (Latin or English) alphabet*/
abcU= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' /*define an uppercase version of [↑]. */
parse arg fileID . /*this last char isn't a middle dot: · */
if fileID=='' then fileID= 'JUNK.TXT' /*¿none specified? Then use the default*/
totChars= 0; totLetters= 0 /*count of all chars and of all letters*/
pad= left('',18); pad9= left('', 18%2) /*used for the indentations of output. */
@.= 0 /*wouldn't it be neat to use Θ instead?*/
do j=1 while lines(fileID)\==0 /*read the file 'til the cows come home*/
rec= linein(fileID) /*get a line/record from the input file*/
/* [↓] process all characters in REC.*/
do k=1 for length(rec) /*examine/count each of the characters.*/
totChars= totChars + 1 /*bump count of number of characters. */
c= substr(rec, k, 1); @.c= @.c + 1 /*Peel off a character; bump its count.*/
if \datatype(c, 'M') then iterate /*Not a Latin letter? Get next char.⌠*/
totLetters= totLetters + 1 /*bump the count for [Latin] letters. ⌡*/
upper c /* ◄─────◄ uppercase a Latin character.*/
@..c= @..c + 1 /*bump the (Latin) letter's count. */
end /*k*/ /*no Greek glyphs: αßΓπΣσµτΦΘΩδφε ··· */
end /*j*/ /*maybe we're ½ done by now, or mäÿbé ¬*/
LL= '(Latin) letter' /*literal used for a "SAY" (below). */
w= length(totChars) /*used for right─aligning the counts. */
say 'file ' fileId "───── has" j-1 'records and has' totLetters LL"s."; say
do L=0 for 256; c= d2c(L) /*display all none─zero letter counts. */
if @..c==0 then iterate /*Has a zero count? Then skip character*/
say pad9 LL' ' c " (also" translate(c,abc,abcU)') count:' right(@..c, w)
end /*L*/ /*we may be in a rut, but not a cañyon.*/
say /*¡The old name for Eygpt was Æygpt! _*/
say 'file ' fileId "───── has" totChars 'characters.' /**/
say /*The name for « » chars is guillemets.*/
do #=0 for 256; y= d2c(#) /*display all none─zero char counts. */
if @.y==0 then iterate /*¿Å zero count? Then ignore character*/
c= d2c(#); ch= c /*C is the character glyph of a char. */
if c<<' ' | #==255 then ch= /*don't show some control characters. */
if c==' ' then ch= 'blank' /*show a blank's {true} name. */
say pad right(ch, 5) " ('"d2x(#,2)"'x character count:" right(@.c, w)
end /*#*/ /*255 isn't quite ∞, but sometimes ∙∙∙ */
say /*not a good place for dithering: ░▒▓█ */
say pad pad9 ' endoflist ' /*show we are at the end of the list. */
/*§§§§ Talk about a mishmash of 2¢ comments. ▬▬^▬▬ stick a fork in it, we're all done. ☻*/
-- 10 Nov 2025
include Setting
arg file
if file='' then
file='Miserables.txt'
say 'LETTER FREQUENCY'
say version
say
call CountLetters(file)
call ShowLetters
call Timer
exit
CountLetters:
procedure expose Lett.
arg file
Lett.=0; a=0; b=0
do while Lines(file)
line=Linein(file); a+=1; l=Length(line); b+=l
do i=1 to l
d=C2d(Substr(line,i,1)); Lett.d+=1
end
end
say a 'lines,' b 'characters'
say
return
ShowLetters:
procedure expose Lett.
say 'l hex dec count'
say '----------------'
do i=0 to 255
if Lett.i>0 then do
say D2c(i) Right(D2x(i),3) Right(i,3) Right(Lett.i,6)
end
end
return
-- Timer
include Timer