pycl/Code/Charty/Charty.py
def ruleInvocation(lststart):
	"""Add all the rules of the grammar to the chart that
	   are relavant:
		Find the rule with the LHS of edge as the leftmost RHS
		symbol and maximally the remaining length of the input."""
	global chart
	change = 0
	for i in range(lststart, len(chart)):
		if chart[i][2] >= len(chart[i][4]): # only inactive edge
			(start, end, index, lhs, rhs, consumed) = chart[i]
			if grammar.rhshash.has_key(lhs):
				for k in grammar.rhshash[lhs]:
					if len(grammar.rhs[k]) > inputlength - start:
						continue
					newedge = [ start, end, 1, grammar.lhs[k], grammar.rhs[k], [i] ]
					if newedge in chart:
						continue
					chart.append(copy(newedge))
					change = 1
					if DEBUG:
						print "RI Adding edge:", newedge
	return change
Add all the rules of the grammar to the chart that
	   are relavant:
		Find the rule with the LHS of edge as the leftmost RHS
		symbol and maximally the remaining length of the input.
Add all the rules of the grammar to the chart that
are relavant:
Find the rule with the LHS of edge as the leftmost RHS
symbol and maximally the remaining length of the input.
Add all the rules of the grammar to the chart that are relavant : Find the rule with the LHS of edge as the leftmost RHS symbol and maximally the remaining length of the input .
def ruleInvocation(lststart):
	global chart
	change = 0
	for i in range(lststart, len(chart)):
		if chart[i][2] >= len(chart[i][4]): 
			(start, end, index, lhs, rhs, consumed) = chart[i]
			if grammar.rhshash.has_key(lhs):
				for k in grammar.rhshash[lhs]:
					if len(grammar.rhs[k]) > inputlength - start:
						continue
					newedge = [ start, end, 1, grammar.lhs[k], grammar.rhs[k], [i] ]
					if newedge in chart:
						continue
					chart.append(copy(newedge))
					change = 1
					if DEBUG:
						print "RI Adding edge:", newedge
	return change
def ruleInvocation ( lststart ) : global chart change = 0 for i in range ( lststart , len ( chart ) ) : if chart [ i ] [ 2 ] >= len ( chart [ i ] [ 4 ] ) : ( start , end , index , lhs , rhs , consumed ) = chart [ i ] if grammar . rhshash . has_key ( lhs ) : for k in grammar . rhshash [ lhs ] : if len ( grammar . rhs [ k ] ) > inputlength - start : continue newedge = [ start , end , 1 , grammar . lhs [ k ] , grammar . rhs [ k ] , [ i ] ] if newedge in chart : continue chart . append ( copy ( newedge ) ) change = 1 if DEBUG : print "RI Adding edge:" , newedge return change
Add all the rules of the grammar to the chart that
are relavant:
Find the rule with the LHS of edge as the leftmost RHS
symbol and maximally the remaining length of the input.
Add all the rules of the grammar to the chart that are relavant : Find the rule with the LHS of edge as the leftmost RHS symbol and maximally the remaining length of the input .
"""Add all the rules of the grammar to the chart that
	   are relavant:
		Find the rule with the LHS of edge as the leftmost RHS
		symbol and maximally the remaining length of the input.""" # only inactive edge
lststart