home *** CD-ROM | disk | FTP | other *** search
- /*
-
- 'The Word Laboratory' 1.0 by Mat Bettinson of London Xenolink Alliance.
-
- This script NEEDS the analysis program LEX to work. Please alter the below
- line to tell it where LEX is.
-
- Anyway else? Erm... Yeah the CPM code is a little weird... It looks for
- consequetive message by a single writer and if the time difference isn't
- ridiculous it will average it out to generate a Characters per minute
- figure. Hardly infalible but it seems to work...
-
- Stipping should remove a lot of bogus characters but UUencodes will give
- stupid results obviously... Don't know how to really check for that
- without making slower that this script already is.
-
- Enjoy... The results are... Interesting...
-
- BTW this is Net/E-Mail ware. Send me a message if you dig it.
-
- Mat Bettinson Fido 2:254/205 E-Mail mat@darkside.demon.co.uk
-
- */
-
- LEX_path = 'utils:'
-
- address 'SPOT'
- signal on syntax
- options results
- NUMERIC DIGITS 5
-
- VER = "1.0"
- cr = '0d'X
- temp_file = 'T:MatStat.temp'
- temp_dir = 'T:'
- numsys=0
-
- 'isarealist'
- IF rc = 0 then DO
- 'requestarea TITLE "Area to Analyse?" USERNAME'
- if result=5 then EXIT
- area = result
- 'gotoarea 'area
- END
- ELSE do
- 'getareaname'
- area=result
- END
-
- /* 'lockgui' */
- 'gotomessage 1'
- 'getnummsgs'
- TotalMessages=result
- IF TotalMessages = 0 THEN signal exit
- prognum=result
- 'getusername'
- Postername=result
-
- 'progressopen TITLE "Sampling data..."'
- pro=result
-
- DO i = 1 to TotalMessages
- IF rc = 5 THEN signal exit
- 'messages'
- 'gotomessage 'i
- 'getfrom'
- Fadd=result
- 'gettimewritten'
- TimeWr=result
- 'saveascii 'temp_file' OVERWRITE noheader nokludges notearline noorigin'
- Call compile
- 'progressupdate 'pro' 'i' 'TotalMessages
- if rc=5 then signal exit
- END
- 'progressclose 'pro
- 'progressopen TITLE "Analysing data..."'
- Score = 0
- Do i = 1 to Numsys
- If TotalBytes.i ~= 0 & TotalTime.i ~= 0 then DO
- CPM = Trunc((TotalBytes.i/TotalTime.i)*60)
- Score.i = CPM
- END
- ELSE Score.i = '-'
- END
- Do i = 1 to NumSYS
- nc = compress(temp_dir||name.i'.txt')
- Address COMMAND Lex_path'LEX 'nc' >T:temp'
- Address COMMAND 'Delete >NIL: 'nc
- Call Open(lex,'T:temp','R')
- Do until EOF(lex)
- line = READLN(lex)
- If left(line,4) = 'Avg.' then AvSyLen.i = strip(word(line,4))
- If left(line,19) = 'Number of sentences' then WdsPSent.i = strip(word(line,7))
- If left(line,11) = 'Gunning-Fog' then GunFog.i = strip(word(line,3))
- If left(line,6) = 'Flesch' then DO
- FleschInd.i = strip(translate((word(line,3)),'',',')) ; FleschGrd.i = strip(word(line,7)) ; END
- If left(line,7) = 'Kincaid' then Kincaid.i = strip(word(line,3))
- END
- Call close(lex)
- Address 'SPOT'
- 'progressupdate 'pro' 'i' 'NumSYS
- if rc = 5 then signal exit
- END
- 'progressclose 'pro
- Area = Centre(Area,14)
- When = Centre(Date(),11)
- day = Centre(date('W'),11)
-
-
- Call Open(out,temp_file,'w')
- Call WriteLN(out,'')
- Call WriteLN(out,' +-----------___-------------------------------------------------------------+')
- Call WriteLN(out,' |'day' | |_ _ | | _ _ _| | _ |_ _ _ _ |_ _ _ Analysing: |')
- Call WriteLN(out," |"When" | | )(- |/\|(_)| (_| |__(_||_)(_)| (_||_(_)| \/"area"|")
- Call WriteLN(out,' +-----------------------------------------------------------/---------------+')
- Call WriteLN(out,' | Writer | BPM | Wd Len | Wd p Sen | Gun Fog | IND-Fles-GRD |Kincaid|')
- Call WriteLN(out,' +----------------|-----|--------|----------|---------|--------------|-------+')
-
- Do p = 1 to NumSYS
- Writer = left(Name.p,16)
- BPM = centre(Score.p,5)
- WdLen = centre(AvSyLen.p,8)
- WdpSen = centre(WdsPSent.p,10)
- GunFog = centre(GunFog.p,9)
- FleschInd = centre(FleschInd.p,4)
- FleschGrd = centre(FleschGrd.p,4)
- Kincaid = centre(Kincaid.p,7)
-
- Outline = ' |'Writer'|'BPM'|'WdLen'|'Wdpsen'|'GunFog'|' FleschInd' 'FleschGrd '|'Kincaid'|'
-
- Call WriteLN(out,Outline)
- END
-
- Call WriteLN(out,' +---------------------------------------------------------------------------+')
- Call WriteLN(out,'')
- Call WriteLN(out,'_KEY_ _Description_')
- Call WriteLN(out,'BPM - Bytes Per Minute (Not always possible to calculate).')
- Call WriteLN(out,'Wd Len - Average Word Length (in sylables) used by the writer.')
- Call WriteLN(out,'Wd p Sen - Aeverage Words per Sentence used by the writer.')
- Call WriteLN(out,'Gun Fog - Gunning Fog-Index: number equals the approximate level of')
- Call WriteLN(out,' schooling (in years) needed to understand text by the writer.')
- Call WriteLN(out,'IND-Fles-GRD - IND : Flesch Index. Inversely preportional to difficulty.')
- Call WriteLN(out,' - GRD : Flesch Grade. Similar to Gunning-Fog in interpretation.')
- Call WriteLN(out,'Kincaid - Kindcaid Index: Similar to Flesch Grade and Gunning-Fog.')
-
- Call WriteLN(out,'')
- Call WriteLN(out,'The more the figures for different algorythms match, the more likely the')
- Call WriteLN(out,'result is accurate for the sample. All the writers text is used for analysis.')
- Call WriteLN(out,'')
- Call WriteLN(out,"All analysis bar BPM is produced using 'LEX' by Jeff Sullivan.")
- Call WriteLN(out,"'The Word Laboratory' written by Mat Bettinson Monday 05-Dec-94")
- Call WriteLN(out,' mat@darkside.demon.co.uk Fidonet: 2:254/205')
-
- Call Close(out)
- 'WRITE TO "ALL" FROM "'postername'" SUBJECT "Word-Lab Analysis" FILE "'temp_file'" NOEDIT NOGUI'
-
- Signal EXIT
-
- compile:
- Call findsys
- temp=translate(TimeWr," ",":")
- Time=(word(temp,1)*3600) + (word(temp,2)*60) + word(temp,3)
- Call msganalyse
- If LA=Fadd then DO
- ETime = Time - LastTime
- IF (Etime < 3000) & (Time > LastTime) then DO
- TotalTime.h = TotalTime.h + ETime
- TotalBytes.h = TotalBytes.h + bulk
- END
- LastTime = time
- END
- ELSE DO
- LA = Fadd
- LastTime = Time
- END
-
- RETURN
-
- findsys:
- Do h = 1 to numsys
- If Name.h = Fadd then RETURN
- END
- Numsys = numsys + 1
- h = Numsys
- Name.h = Fadd
- TotalTime.h = 0
- TotalBytes.h = 0
- RETURN
-
- msganalyse:
- Call Open(anly,temp_file,'R')
- fn = compress(temp_dir||Name.h'.txt')
- If Exists(fn) then Call Open(usr,fn,'A')
- ELSE Call Open(usr,fn,'W')
- bulk = 0
- Do until EOF(anly)
- line = READLN(anly)
- If left(line,3) = '...' then break
- if Index(left(line,5),'>') = 0 then DO
- bulk = bulk + length(line)
- wtout = Compress(line,'_-\"0123456789£$%^&*;:<>()=+')
- Call WriteLN(usr,wtout)
- END
- END
- Call Close(anly)
- Call Close(usr)
- RETURN
-
- syntax:
- say rc errortext(rc) 'in line' SIGL
- failure:
- exit:
- 'unlockgui'
- IF pro ~= 'PRO' THEN
- 'progressclose' pro
- 'messages'
- 'lastmessage'
- exit
-