Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
42
Task/Letter-frequency/REXX/letter-frequency-1.rexx
Normal file
42
Task/Letter-frequency/REXX/letter-frequency-1.rexx
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*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 '☼ end─of─list ☼' /*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. ☻*/
|
||||
61
Task/Letter-frequency/REXX/letter-frequency-2.rexx
Normal file
61
Task/Letter-frequency/REXX/letter-frequency-2.rexx
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/*REXX program counts the occurences of all characters in a file
|
||||
* Adapted version 1 for TSO (EXECIO instead of linein)
|
||||
* No translation to uppercase takes place
|
||||
* There is no need for tails being hex
|
||||
* 25.07.2012 Walter Pachl
|
||||
***********************************************************************/
|
||||
|
||||
Parse arg dsn . /*Data set to be processed */
|
||||
if dsn='' Then /*none specified? */
|
||||
dsn='PRIV.V100(TEST)' /* Use default. */
|
||||
c.=0 /* Character counts */
|
||||
"ALLOC FI(IN) DA("dsn") SHR REUSE"
|
||||
'EXECIO * DISKR IN (STEM L. FINIS'
|
||||
'FREE FI(IN)'
|
||||
totChars=0 /*count of the total num of chars*/
|
||||
totLetters=0 /*count of the total num letters.*/
|
||||
indent=left('',20) /*used for indentation of output.*/
|
||||
|
||||
do j=1 to l.0 /*process all lines */
|
||||
rec=l.j /*take line number j */
|
||||
Say '>'rec'<' length(rec) /*that's in PRIV.V100(TEST) */
|
||||
Say ' E8C44D8FF015674BCDEF'
|
||||
Say ' 61100711200000000002'
|
||||
do k=1 for length(rec) /*loop over characters */
|
||||
totChars=totChars+1 /*Increment total number of chars*/
|
||||
c=substr(rec,k,1) /*get character number k */
|
||||
c.c=c.c+1 /*increment the character's count*/
|
||||
End
|
||||
End /*maybe we're ½ done by now, or ¬*/
|
||||
|
||||
w=length(totChars) /*used for right-aligning counts.*/
|
||||
say 'file -----' dsn "----- has" j-1 'records.'
|
||||
say 'file -----' dsn "----- has" totChars 'characters.'
|
||||
|
||||
do L=0 to 255 /* display nonzero letter counts */
|
||||
c=d2c(l) /* the character in question */
|
||||
if c.c>0 &, /* was found in the file */
|
||||
datatype(c,'M')>0 Then Do /* and is a Latin letter */
|
||||
say indent "(Latin) letter " c 'count:' right(c.c,w) /* tell */
|
||||
totLetters=totLetters+c.c /* increment number of letters */
|
||||
End
|
||||
End
|
||||
|
||||
say 'file -----' dsn "----- has" totLetters '(Latin) letters.'
|
||||
say ' other characters follow'
|
||||
other=0
|
||||
do m=0 to 255 /* now for non-letters */
|
||||
c=d2c(m) /* the character in question */
|
||||
y=c2x(c) /* the hex representation */
|
||||
if c.c>0 &, /* was found in the file */
|
||||
datatype(c,'M')=0 Then Do /* and is not a Latin letter */
|
||||
other=other+c.c /* increment count */
|
||||
_=right(c.c,w) /* prepare output of count */
|
||||
select /*make the character viewable. */
|
||||
when c<<' ' | m==255 then say indent "'"y"'x character count:" _
|
||||
when c==' ' then say indent "blank character count:" _
|
||||
otherwise say indent " " c 'character count:' _
|
||||
end
|
||||
end
|
||||
end
|
||||
say 'file -----' dsn "----- has" other 'other characters.'
|
||||
Loading…
Add table
Add a link
Reference in a new issue