Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def confidence(raw_input_string):
tokenizer = nltk.WordPunctTokenizer()
tokenized_string = tokenizer.tokenize(raw_input_string)
yesDistanceSet = utils.min_synset_distance_in_sentence(
YesNoMessage.yes_keywords,
tokenized_string)
noDistanceSet = utils.min_synset_distance_in_sentence(
YesNoMessage.no_keywords,
tokenized_string)
# check minDistance
if yesDistanceSet and yesDistanceSet[1] <= YesNoMessage.minDistance:
return 1.0
else:
yesDistanceSet = None
if noDistanceSet and noDistanceSet[1] <= YesNoMessage.minDistance:
return 1.0
else:
noDistanceSet = None
if yesDistanceSet == None and noDistanceSet == None:
return 0.0
def confidence(raw_input_string):
tokenizer = nltk.WordPunctTokenizer()
tokenized_string = tokenizer.tokenize(raw_input_string)
yesDistanceSet = utils.min_synset_distance_in_sentence(
YesNoMessage.yes_keywords,
tokenized_string)
noDistanceSet = utils.min_synset_distance_in_sentence(
YesNoMessage.no_keywords,
tokenized_string)
# check minDistance
if yesDistanceSet and yesDistanceSet[1] <= YesNoMessage.minDistance:
return 1.0
else:
yesDistanceSet = None
if noDistanceSet and noDistanceSet[1] <= YesNoMessage.minDistance:
return 1.0
else:
noDistanceSet = None
if yesDistanceSet == None and noDistanceSet == None:
return 0.0
def confidence(raw_input_string):
tokenizer = nltk.WordPunctTokenizer()
tokenized_string = tokenizer.tokenize(raw_input_string)
yesDistanceSet = utils.min_synset_distance_in_sentence(
YesNoMessage.yes_keywords,
tokenized_string)
noDistanceSet = utils.min_synset_distance_in_sentence(
YesNoMessage.no_keywords,
tokenized_string)
# check minDistance
if yesDistanceSet and yesDistanceSet[1] <= YesNoMessage.minDistance:
return 1.0
else:
yesDistanceSet = None
if noDistanceSet and noDistanceSet[1] <= YesNoMessage.minDistance:
return 1.0
else:
noDistanceSet = None
if yesDistanceSet == None and noDistanceSet == None:
return 0.0