IntroCModelingLA/Code/MIParser.py
def scoreParse(self, parse, correct):
		"""Compares the algorithms parse and the correct parse and assigns a score for that parse.
			 The score is based upon how far apart the right and left parentheses are from each other
			 in the two parses and also includes a penalty for parentheses in one parse but not the
			 other.
		"""
		score = 0
		compCnt = string.count(parse, "(")
		realCnt = string.count(correct, "(")
		compPos = -1
		realPos = -1
		for i in range(compCnt):
			compPos = string.find(parse, "(", compPos+1, len(parse))
			realPos = string.find(correct, "(", realPos+1, len(correct))
			score += abs(compPos - realPos)
		score += abs(compCnt - realCnt)
		compCnt = string.count(parse, ")")
		realCnt = string.count(correct, ")")
		compPos = -1
		realPos = -1
		for i in range(compCnt):
			compPos = string.find(parse, ")", compPos+1, len(parse))
			realPos = string.find(correct, ")", realPos+1, len(correct))
			score += abs(compPos - realPos)
		score += abs(compCnt - realCnt)
		return score
Compares the algorithms parse and the correct parse and assigns a score for that parse.
			 The score is based upon how far apart the right and left parentheses are from each other
			 in the two parses and also includes a penalty for parentheses in one parse but not the
			 other.
		
Compares the algorithms parse and the correct parse and assigns a score for that parse.
The score is based upon how far apart the right and left parentheses are from each other
in the two parses and also includes a penalty for parentheses in one parse but not the
other.
Compares the algorithms parse and the correct parse and assigns a score for that parse . The score is based upon how far apart the right and left parentheses are from each other in the two parses and also includes a penalty for parentheses in one parse but not the other .
def scoreParse(self, parse, correct):
		score = 0
		compCnt = string.count(parse, "(")
		realCnt = string.count(correct, "(")
		compPos = -1
		realPos = -1
		for i in range(compCnt):
			compPos = string.find(parse, "(", compPos+1, len(parse))
			realPos = string.find(correct, "(", realPos+1, len(correct))
			score += abs(compPos - realPos)
		score += abs(compCnt - realCnt)
		compCnt = string.count(parse, ")")
		realCnt = string.count(correct, ")")
		compPos = -1
		realPos = -1
		for i in range(compCnt):
			compPos = string.find(parse, ")", compPos+1, len(parse))
			realPos = string.find(correct, ")", realPos+1, len(correct))
			score += abs(compPos - realPos)
		score += abs(compCnt - realCnt)
		return score
def scoreParse ( self , parse , correct ) : score = 0 compCnt = string . count ( parse , "(" ) realCnt = string . count ( correct , "(" ) compPos = - 1 realPos = - 1 for i in range ( compCnt ) : compPos = string . find ( parse , "(" , compPos + 1 , len ( parse ) ) realPos = string . find ( correct , "(" , realPos + 1 , len ( correct ) ) score += abs ( compPos - realPos ) score += abs ( compCnt - realCnt ) compCnt = string . count ( parse , ")" ) realCnt = string . count ( correct , ")" ) compPos = - 1 realPos = - 1 for i in range ( compCnt ) : compPos = string . find ( parse , ")" , compPos + 1 , len ( parse ) ) realPos = string . find ( correct , ")" , realPos + 1 , len ( correct ) ) score += abs ( compPos - realPos ) score += abs ( compCnt - realCnt ) return score
Compares the algorithms parse and the correct parse and assigns a score for that parse.
Compares the algorithms parse and the correct parse and assigns a score for that parse .
"""Compares the algorithms parse and the correct parse and assigns a score for that parse.
			 The score is based upon how far apart the right and left parentheses are from each other
			 in the two parses and also includes a penalty for parentheses in one parse but not the
			 other.
		"""
self
parse
correct