<commit_before>require "calculator.rb"

class ExpressionBuilder

	def initialize
		@lines = []
		@defined_variables = []
	end

	def add_line(line)

		# Get the assignment of this line
		assignment = "ans"
		if line.index("=")
			assignment = line.split("=")[0].strip
		end

		# Verify that if varaibles are used in the line they are correct
		verify_line(line[(line.index("=") || 0), line.length])

		# Add the lines assigne to the list of defined variables
		if assignment == "ans" && !variable_defined?("ans")
			@defined_variables << assignment
		elsif !variable_defined?(assignment)
			@defined_variables << assignment
		end
		
		# Add the line to the list of lines
		@lines << line
	end

	def variable_defined?(var)
		#return false if !@defined_variables
		return @defined_variables.include?(var)
	end
<commit_msg>Set Variable Function Added a function that simplyfys adding a variable to your calculation<commit_after>require "calculator.rb"

class ExpressionBuilder

	def initialize
		@lines = []
		@defined_variables = []
	end

	def add_line(line)

		# Get the assignment of this line
		assignment = "ans"
		if line.index("=")
			assignment = line.split("=")[0].strip
		end

		# Verify that if varaibles are used in the line they are correct
		verify_line(line[(line.index("=") || 0), line.length])

		# Add the lines assigne to the list of defined variables
		if assignment == "ans" && !variable_defined?("ans")
			@defined_variables << assignment
		elsif !variable_defined?(assignment)
			@defined_variables << assignment
		end
		
		# Add the line to the list of lines
		@lines << line
	end

	def set_variable(var_name, var_value)
		@defined_variables << var_name
		@lines << "#{var_name}=#{var_value}"
	end

	def variable_defined?(var)
		#return false if !@defined_variables
		return @defined_variables.include?(var)
	end

{'fraction_non_alphanumeric': 0.10911074740861974, 'fraction_numerical': 0.002182214948172395, 'mean_word_length': 4.2250712250712255, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 3, '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': '5184670', 'n_tokens_mistral': 629, 'n_tokens_neox': 564, 'n_words': 181}