cleaned up comments

batch
Jeff Yates 2020-10-24 11:27:47 -04:00
parent e12c6af35e
commit a09a3a3be1
1 changed files with 28 additions and 6 deletions

View File

@ -4,18 +4,16 @@
#More documentation TBD # #More documentation TBD #
#Current Usage: # #Current Usage: #
# Scans a file for groups of words and counts the totals # # Scans a file for groups of words and counts the totals #
# Input file: ./tester.txt # # Accepts the following options: #
# Word group file: ./bins.json # # --file - the name of the text to sort #
# Output file: ./output.json # # --type - iat or pn #
# --bin-file - the name of the bin csv file #
# # # #
# The input file is human readable, easy to edit. # # The input file is human readable, easy to edit. #
# The output file is single-line JSON, use jq to format for reading. # # The output file is single-line JSON, use jq to format for reading. #
# # # #
#To Do: # #To Do: #
# * use STDIN to accept file to scan #
# * Support scanning multiple files #
# * Output to csv # # * Output to csv #
# * Strip out header and footer text #
############################################################################ ############################################################################
require 'json' require 'json'
require 'pp' require 'pp'
@ -63,6 +61,30 @@ def strip_text (text, start, fin)
text.lines(start,chomp: true)[1].lines(fin,chomp: true)[0] text.lines(start,chomp: true)[1].lines(fin,chomp: true)[0]
end end
#split_text expects:
# text - the text we're working on
# start - the starting string to search for
# fin the ending string to search for
# This method returns everything between start and fin and handles multiple sections
# Example:
# For the following text:
# > asdfasdf
# > AAAAA
# > testing
# > abcdefg
# > BBBBB
# > nothing
# > something
# > AAAAA
# > moo said the cow.
# > cluck said the chicken.
# > BBBBB
# > bark said the dog
# Running split_text(text, 'AAAAA', 'BBBBB') would return:
# > testing
# > abcdefg
# > moo said the cow.
# > cluck said the chicken.
def split_text (text, start, fin) def split_text (text, start, fin)
split1 = text.lines(start, chomp: true)[1..-1] split1 = text.lines(start, chomp: true)[1..-1]
split2 = [] split2 = []