' $DYNAMIC count = 0 totalwords = 0 CLS DIM array(1500) AS STRING DIM spoken(1500) AS INTEGER PRINT "This file creates a concordance for each selected character." PRINT "It will show number of words spoken, and how many times each word" PRINT "Was spoken, along with their vocabulary in number of words." PRINT PRINT "Enter character or press Enter to use charfile" INPUT "or type 'everyone' to process entire movie file: ", name$ IF name$ = "everyone" THEN GOTO d IF name$ <> "" THEN GOTO a OPEN "i", 3, "charfile.dat" b: IF NOT EOF(3) THEN INPUT #3, char$: name$ = char$: IF name$ = "" THEN GOTO c a: OPEN "i", 1, name$ + ".doc" OPEN "o", 2, name$ PRINT "Processing character: "; name$ INPUT #1, word$ totalwords = 1 array(0) = word$ spoken(0) = 1 count = 0 vocab = 1 DO IF NOT EOF(1) THEN INPUT #1, word$ totalwords = totalwords + 1 IF word$ <> array(count) THEN count = count + 1 array(count) = word$ vocab = vocab + 1 spoken(count) = spoken(count) + 1 ELSE spoken(count) = spoken(count) + 1 END IF END IF LOOP UNTIL EOF(1) CLOSE #1 PRINT #2, "Character concordance file for "; name$ PRINT #2, "" PRINT #2, "Total words spoken by "; name$; " = "; totalwords PRINT #2, "" PRINT #2, "Total vocabulary of "; name$; " = "; vocab; " words." PRINT #2, "" FOR num = 0 TO count PRINT #2, array(num) + SPACE$(30 - LEN(array(num))); PRINT #2, spoken(num) NEXT num CLOSE #2 IF char$ = "" THEN END IF NOT EOF(3) THEN FOR num = 0 TO totalwords array(num) = "" spoken(num) = 0 NEXT num totalwords = 0 vocab = 0 count = 0 GOTO b END IF c: CLOSE #3 END d: OPEN "i", 1, "everyone.doc" OPEN "o", 2, "everyone" PRINT "Processing entire movie file. Creating concordance." INPUT #1, word$ array(0) = word$ spoken(0) = 1 totalwords = 1 vocab = 1 count = 0 PRINT #2, "The Lion King Concordance File" PRINT #2, "" FOR char = 39 TO 122 DO IF NOT EOF(1) THEN INPUT #1, word$ IF word$ <> "" THEN totalwords = totalwords + 1 IF LEFT$(word$, 1) = CHR$(char) THEN IF word$ <> array(count) THEN count = count + 1 array(count) = word$ vocab = vocab + 1 spoken(count) = spoken(count) + 1 ELSE spoken(count) = spoken(count) + 1 END IF END IF END IF LOOP UNTIL EOF(1) OR LEFT$(word$, 1) <> CHR$(char) FOR num = 0 TO count IF array(num) <> "" THEN PRINT #2, array(num) + SPACE$(30 - LEN(array(num))); PRINT #2, spoken(num) END IF array(num) = "" spoken(num) = 0 NEXT num count = 0 IF EOF(1) THEN GOTO e IF char = 39 THEN char = 96 NEXT char e: CLOSE #1 PRINT #2, "Total words spoken in The Lion King = "; totalwords PRINT #2, "Vocabulary of The Lion King = "; vocab; " words."; CLOSE #2