Beispiel #1
0
def prior_sample(h0, data, N):
	"""
		Just use the grammar and returntype of h0 to sample from the prior
		NOTE: Only implemented for LOTHypothesis
	"""
	assert isinstance(h0, LOTHypothesis)
	
	# extract from the grammar
	G = h0.grammar 
	rt = h0.value.returntype
	
	for i in xrange(N):
		if LOTlib.SIG_INTERRUPTED: break
	
		h = LOTHypothesis(G, start=rt)
		h.compute_posterior(data)
		
		yield h