<commit_before>require 'pry'
require 'json'
require 'differ'
require 'levenshtein'
require 'erb'

require_relative 'summary'

require_relative 'utils'

require_relative 'related'
require_relative 'counters'
require_relative 'curator'
require_relative 'condense'
require_relative 'presenter'

title = ARGV[0].scan(/\/(\w+)_p/).flatten.first
  .gsub(/(.)([A-Z])/,'\1 \2').split(" ").map(&:capitalize).join(" ")
lines = File.open(ARGV[0]).readlines
topics = lines.first.split(",").map(&:strip)
points = lines[2..-1].map { |l| JSON.parse(l) }
summary = Summary.new(title, points, topics, 3)
summary.build

@title = title
@summary = summary
erb = ERB.new(File.open("template.html.erb").read, 0, '>')
html = erb.result binding
File.open(title.downcase + "_summary.html", "w").write(html)

File.open(title.downcase + "_summary.json", "w").write(summary.to_h.to_json)
<commit_msg>Correct naming of generated files<commit_after>require 'pry'
require 'json'
require 'differ'
require 'levenshtein'
require 'erb'

require_relative 'summary'

require_relative 'utils'

require_relative 'related'
require_relative 'counters'
require_relative 'curator'
require_relative 'condense'
require_relative 'presenter'

title = ARGV[0].scan(/\/(\w+)_p/).flatten.first
  .gsub(/(.)([A-Z])/,'\1 \2').split(" ").map(&:capitalize).join(" ")
lines = File.open(ARGV[0]).readlines
topics = lines.first.split(",").map(&:strip)
points = lines[2..-1].map { |l| JSON.parse(l) }
summary = Summary.new(title, points, topics, 3)
summary.build

@title = title
@summary = summary
erb = ERB.new(File.open("template.html.erb").read, 0, '>')
html = erb.result binding
File.open(title.downcase.gsub(/\W+/, "_") + "_summary.html", "w").write(html)

File.open(title.downcase.gsub(/\W+/, "_") + "_summary.json", "w").write(summary.to_h.to_json)

{'fraction_non_alphanumeric': 0.20133481646273638, 'fraction_numerical': 0.008898776418242492, 'mean_word_length': 5.638376383763838, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4771755', 'n_tokens_mistral': 681, 'n_tokens_neox': 670, 'n_words': 122}