Word Stats is a composition analyzer software designed to generate statistical information about English compositions.
Features of Word Stats :
- Support Batch Processing
- Open Source
- Using Pascal as Programming Language
- Well-Structured Functions and Procedures
- Click to get more features in YouTube video.
By selecting the text file to be read, users may get results like :
- frequencies of letters
- frequency of a given word/expression
- total number of words and paragraphs
Furthermore, Word Stats provides users with customizable result return methods :
- append results in original text file
- output results in another text file
- Open wordstats.exe.
- Enter the Path of the Folder1 contain text files to be read.
- Select the next action to be taken from the main menu.
- Get frequencies of letters
- Get total number of words and paragraphs
- Get frequency of a given word/expression
- Program Preference (See "Change Path, Output Mode and Batch Mode")
- Quit
- Select text file to be read. (Not in Batch Mode) 2
- Result will be shown on terminal, select the output mode (If have not been set in
Program Preference
) - To exit the program, choose
Quit
option in main menu.
By choosing Program Preference
in main menu, another menu will be shown.
Choosing Change Destination Path
will ask users to enter a new destination Path.
Choosing Result Return Preference
will ask users to choose one from the followings :
- Always Append Result in Original File
- Always Return Result in Another File
- Always Ask After Runs
- Never Record Result in Text File
The default result return mode is 3: Always Ask After Runs. 4
Choosing Batch Processing Preference
will switch Batch Processing mode on and off, but will always remain Off when the folder only contains one text file. The program will ask users to choose a Return Mode before perform any action. 3
Under Batch Mode, all text files in the destination path will be read in every action taken.
For users who know Pascal Language and hope to :
- perform personal modification.
- use functions and proceduces from the source file in other program. 5
You can edit the source file wordstats.pas in any IDE you like.
Make sure you have a Pascal compiler software. Here are some examples :
- Free Pascal (Recommended)
- Dev-Pascal IDE (Compiler Integrated)
- Lazarus
- GNU Pascal
Print_List()
This is a procedure.
Shows main menu for users' selection and undergoes file select section.
This is the base procedure that control whole program workflow according to users selections and it calls most functions and procedures.
Raises:
- OutofRangeError - Users' invalid input that mismatch from the main menu.
Print_PList()
This is a procedure.
Shows Program Preference
menu and control setting of Destination Path
, Return Mode
and Batch Processing Mode
.
This procedure is used in Print_List()
Raises:
- OutofRangeError - Users' invalid input that mismatch from the
Program Preference
menu.
Word_Count(rfname)
This is a procedure.
Count the total number of words in the selected text file.
This procedure include result output section.
Parameters:
- rfname(String) : The file name of the selected text file.
Raises:
- OutofRangeError - Users' invalid input that mismatch from the result return menu.
Word_Freq(rfname)
This is a procedure.
Count the frequencies of input words in the selected text file.
This procedure include expression input and result output sections.
Parameters:
- rfname(String) : The file name of the selected text file.
Raises:
- OutofRangeError - Users' invalid input that mismatch from the result return menu.
Char_Freq(rfname)
This is a procedure.
Count the frequencies of each existed letters in the selected text file.
This procedure include result output section.
Parameters:
- rfname(String) : The file name of the selected text file.
Raises:
- OutofRangeError - Users' invalid input that mismatch from the result return menu.
CheckWordFinished(S, I)
This is a function.
Check the end of words by checking whether a digit is space, comma, or fullstop.
This function is used in Word_Count()
and Word_Freq()
.
Parameters:
- S(String) : The whole string to be checked.
- I(Integer) : The index of the digit to be checked.
Returns
True
if the digit is space, comma, or fullstop.False
otherwise.
Returns Type
- Boolean
Raises:
- OutofRangeError - The index inputted is larger than the length of the string.
DPathChange()
This is a procedure.
Change the destination path and load all txt files in destination path to Namelist
.
This procedure is used in program initialization and Print_PList()
.
Raises:
- DirectoryNotFoundError - Users input wrong path that not exist.
- OutofRangeError - The number of txt files in the destination path is larger than the maximum of 50.
Select_File(M, Tfile)
This is a function.
Load the txt file names from Namelist
and output as a menu for file selection.
This function is used in Word_Count()
, Word_Freq()
, Char_Freq()
and Print_List()
.
Parameters:
- M(Integer) : The mode of openning a file, 1 for reading and 2 for output.
- Tfile(Text) : The text variable for the file, call by reference.
Returns
- The whole path of the textfile.
Returns Type
- String
Raises:
- OutofRangeError - The index inputted is larger than the menu shown.
Footnotes
-
The path should be the folder contain the text file, not the direct path to the text file. ↩ ↩2
-
You can type "l" to refer to the text file from previous run. (Cannot be used in first run) ↩
-
When Batch Mode is on, return mode cannot be changed and Option "Always Ask" is unusable. ↩ ↩2
-
This will be reset to default after the executable restart. ↩
-
All copying of source code should follow the GNU License. ↩