Skip to content

Latest commit

 

History

57 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Analyzing Text in Ruby

An example implementation of the text-analysis project.

Files In This Repository

  1. textalyze.rb is the source code for this project
  2. textalyze_test.rb contains tests for the code in textalyze.rb
  3. sample_data is a directory containing sample text files to analyze, mostly from Project Gutenberg.

Usage

$ ruby textalyze.rb <text file>

Where <text file> is the filename of a plain-text file to be analyzed.

Displays a histogram chart of frequencies for each alphanumeric character in the text provided.

Example

$ ruby textalyze.rb ./sample_data/moby-dick.txt
The counts for ./sample_data/moby-dick.txt are...
a [ 8.26%] ############################################
b [ 1.43%] #######
c [ 2.29%] ############
# ...

Tests

Tests are in the textalyze_test.rb file.

$ ruby textalyze_test.rb

Running tests for frequencies()...
true
true
# ...

About

A Ruby program that displays various statistics about a piece of text.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages