def main():
	# arg variables
	grammarFile = "file:" + sys.argv[1]
	sentenceFile = sys.argv[2]

	# create grammar
	grammar = nltk.data.load(grammarFile)
	parser = nltk.parse.EarleyChartParser(grammar)
	
	# read in the sentences
	sentenceList = []
	sentenceFileStream = open(sentenceFile)
	sentence = sentenceFileStream.readline()

	while sentence:
		# first, strip sentence so we can detect empty string
		strippedSentence = sentence.strip()
		# add if length is 0
		if len(sentenceList) == 0 and len(strippedSentence) > 0:
			sentenceList.append(strippedSentence)
		# process if length is 1
		elif len(sentenceList) == 1 and len(strippedSentence) > 0:
			trees = utils.buildTreesFromSentences(sentenceList[0], strippedSentence, parser)

			hobbsInst = hobbs.Hobbs(trees[0], trees[1])
			handleHobbsInstance(hobbsInst)

			sentenceList = []

		# read new sentence
		sentence = sentenceFileStream.readline()
	def test_ctor_finds_pronouns(self):
		# arrange
		firstSentence = "Scientists rescued a mouse immune system."
		secondSentence = "They published the research today online."
		(firstTree, secondTree) = utils.buildTreesFromSentences(firstSentence, secondSentence, parser)

		# act
		hobbsInst = hobbs.Hobbs(firstTree, secondTree)

		# assert
		self.assertTrue(len(hobbsInst.foundPronouns) == 1, str(len(hobbsInst.foundPronouns)))
	def test_determines_antecedents_difficult(self):
		# arrange
		firstSentence = "Scientists restored immunity in mice with a weak immune system."
		secondSentence = "They injected them with a live vaccine."
		(firstTree, secondTree) = utils.buildTreesFromSentences(firstSentence, secondSentence, parser)
		hobbsInst = hobbs.Hobbs(firstTree, secondTree)

		# act
		results = list(hobbsInst.findAntecedents())

		# assert
		self.assertTrue(len(hobbsInst.foundPronouns) == 2, str(len(hobbsInst.foundPronouns)))
		self.assertTrue(len(results) == 24, str(len(results)))
	def test_determines_antecedents(self):
		# arrange
		firstSentence = "Scientists rescued a mouse immune system."
		secondSentence = "They published the research today online."
		(firstTree, secondTree) = utils.buildTreesFromSentences(firstSentence, secondSentence, parser)
		hobbsInst = hobbs.Hobbs(firstTree, secondTree)

		# act
		results = list(hobbsInst.findAntecedents())

		# assert
		self.assertTrue(len(hobbsInst.foundPronouns) == 1, str(len(hobbsInst.foundPronouns)))
		self.assertTrue(len(results) == 7, str(len(results)))
	def test_creates_traversing_tree(self):
		# arrange
		firstSentence = "Scientists rescued a mouse immune system."
		secondSentence = "They published the research today online."
		(firstTree, secondTree) = utils.buildTreesFromSentences(firstSentence, secondSentence, parser)

		# act
		travTree = traversableTree.TraversableTree(firstTree, None, rules)

		# assert
		self.assertTrue(travTree != None)

		self.assertTrue(len(travTree.children) == 3)
		np = travTree.children[0]

		self.assertTrue(np.parent == travTree)