Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if subjects:
self.frame['subject'] = [get_node_string(subject)
for subject in subjects]
words_temporary_pos = extract_close_keywords(
PreferenceMessage.keywords_temporary_pos,
tokenized_string,
2)
words_temporary_neg = extract_close_keywords(
PreferenceMessage.keywords_temporary_neg,
tokenized_string,
2)
words_permanent_pos = extract_close_keywords(
PreferenceMessage.keywords_permanent_pos,
tokenized_string,
2)
words_permanent_neg = extract_close_keywords(
PreferenceMessage.keywords_permanent_neg,
tokenized_string,
2)
words_temporary = words_temporary_pos + words_temporary_neg
words_permanent = words_permanent_pos + words_permanent_neg
if words_temporary and words_permanent:
# Confused
# self.frame['temporal'] = None
# self.frame['word'] = None
# This check is skipped due to an error in not using the POS
# when looking up synsets.
# TODO: Fix (example: fish)
pass
if words_temporary:
self.frame['temporal'] = 'temporary'
self.frame['word'] = words_temporary[0]
tokenized_string = g.generate_tokenized_string(raw_input_string)
parseTree = g.generate_stanford_parse_tree(raw_input_string)
subjects = extract_subject_nodes(parseTree)
if subjects:
self.frame['subject'] = [get_node_string(subject)
for subject in subjects]
words_temporary_pos = extract_close_keywords(
PreferenceMessage.keywords_temporary_pos,
tokenized_string,
2)
words_temporary_neg = extract_close_keywords(
PreferenceMessage.keywords_temporary_neg,
tokenized_string,
2)
words_permanent_pos = extract_close_keywords(
PreferenceMessage.keywords_permanent_pos,
tokenized_string,
2)
words_permanent_neg = extract_close_keywords(
PreferenceMessage.keywords_permanent_neg,
tokenized_string,
2)
words_temporary = words_temporary_pos + words_temporary_neg
words_permanent = words_permanent_pos + words_permanent_neg
if words_temporary and words_permanent:
# Confused
# self.frame['temporal'] = None
# self.frame['word'] = None
# This check is skipped due to an error in not using the POS
# when looking up synsets.
# TODO: Fix (example: fish)
def _parse(self, raw_input_string, g):
"""
Fills out message meta and frame attributes.
"""
tokenized_string = g.generate_tokenized_string(raw_input_string)
parseTree = g.generate_stanford_parse_tree(raw_input_string)
subjects = extract_subject_nodes(parseTree)
if subjects:
self.frame['subject'] = [get_node_string(subject)
for subject in subjects]
words_temporary_pos = extract_close_keywords(
PreferenceMessage.keywords_temporary_pos,
tokenized_string,
2)
words_temporary_neg = extract_close_keywords(
PreferenceMessage.keywords_temporary_neg,
tokenized_string,
2)
words_permanent_pos = extract_close_keywords(
PreferenceMessage.keywords_permanent_pos,
tokenized_string,
2)
words_permanent_neg = extract_close_keywords(
PreferenceMessage.keywords_permanent_neg,
tokenized_string,
2)
words_temporary = words_temporary_pos + words_temporary_neg
def _parse(self, raw_input_string):
"""
Fills out message meta and frame attributes
"""
tokenizer = nltk.WordPunctTokenizer()
tokenized_string = tokenizer.tokenize(raw_input_string)
tagger = utils.combined_taggers
tagged_string = tagger.tag(tokenized_string)
wordActionMap = {'exit':SystemMessage.exit_keywords, 'restart':SystemMessage.restart_keywords}
for action, keywords in wordActionMap.items():
matches = extract_close_keywords(keywords, tokenized_string, 3)
if matches: # synset of keyword was found in the sentence
self.frame['action'] = action
def _parse(self, raw_input_string, g):
"""
Fills out message meta and frame attributes.
"""
tokenized_string = g.generate_tokenized_string(raw_input_string)
parseTree = g.generate_stanford_parse_tree(raw_input_string)
subjects = extract_subject_nodes(parseTree)
if subjects:
self.frame['subject'] = [get_node_string(subject)
for subject in subjects]
words_temporary_pos = extract_close_keywords(
PreferenceMessage.keywords_temporary_pos,
tokenized_string,
2)
words_temporary_neg = extract_close_keywords(
PreferenceMessage.keywords_temporary_neg,
tokenized_string,
2)
words_permanent_pos = extract_close_keywords(
PreferenceMessage.keywords_permanent_pos,
tokenized_string,
2)
words_permanent_neg = extract_close_keywords(
PreferenceMessage.keywords_permanent_neg,
tokenized_string,
2)
words_temporary = words_temporary_pos + words_temporary_neg
words_permanent = words_permanent_pos + words_permanent_neg
if words_temporary and words_permanent:
# Confused
# self.frame['temporal'] = None