How to use the ngram.rateSentence function in ngram

To help you get started, we’ve selected a few ngram examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codysmithd / SAIL / sentence_assembler.py View on Github external
def rateSentence():
	global sentence
	global finished_sentences
	global max_rating

	rating = ngram.rateSentence(sentence)

	if rating[0] == max_rating:
		addSentence(rating)
	elif rating[0] > max_rating:
		max_rating = rating[0]
		finished_sentences = []
		addSentence(rating)