extractor module

interpreter.extractor.binary_search_shown_words(target, pool)[source]
interpreter.extractor.build_shown_words(filename)[source]
interpreter.extractor.is_direction(word)[source]

Checks if a word represents a direction.

The word is checked against a hard-coded list of directional words. If there is a match, then the word is determined to be a directional word. This function is present to provide a space to make this operation more robust in the future.

Parameters:word (str) – The word to be checked
Returns:True if the word represents a directional word, False if not
Return type:bool
interpreter.extractor.is_noun(tag)[source]

Checks if a part of speech tag represents a noun. The tags "PRP" and those that begin with "NN" are considered nouns.

Parameters:tag (str) – The part of speech tag to be checked
Returns:True if the tag represents a noun, False if not
Return type:bool
interpreter.extractor.is_preposition(tag)[source]

Checks if a part of speech tag represents a preposition. The tags "TO" and "IN" considered to be prepositions.

Parameters:tag (str) – The part of speech tag to be checked
Returns:True if the tag represents a preposition, False if not
Return type:bool
interpreter.extractor.object_dict_follow(sent)[source]

Extracts objects out of a sentence that contains follow as its action

Rules:

  1. The first noun encountered is always the person
  2. The second noun (if included) is always the place

Objects:

  1. person - The person who will be followed
  2. place - The location that the person will be followed to
Parameters:sent (list) – A part of speech tagged list of tokens representing a sentence
Returns:An object dictionary for the command
Return type:dict
interpreter.extractor.object_dict_move(sent)[source]

Extracts objects out of a sentence that contains move as its action

Rules:

  1. Only the first noun is detected as an object
  2. If the first noun is preced by a preposition, then it is the place
  3. If the first noun is not preceded by a preposition, then it is the direction

Objects:

  1. place - A location to move to
  2. direction - A direction to move in
Parameters:sent (list) – A part of speech tagged list of tokens representing a sentence
Returns:An object dictionary for the command
Return type:dict
interpreter.extractor.object_dict_show(sent)[source]

Extracts objects out of a sentence that contains show as its action

Rules:

  1. The verb preceded by a to is the shown_action
  2. The noun that is not preceded by a determiner or to is the person
  3. The noun that is preceded either by a determiner or the shown_action is the object

Objects:

  1. shown_action - The action that will be shown in a video
  2. person - The person who will be shown the action or object
  3. object - The object that is acted on in the video or a static object to be shown as a picture
  4. video_title - The title of the video to be played; it is currently generated by concatentating the shown_action with the object
Parameters:sent (list) – A part of speech tagged list of tokens representing a sentence
Returns:An object dictionary for the command
Return type:dict
interpreter.extractor.object_dict_stop(sent)[source]

Extracts objects out of a sentence that contains stop as its action

Currently returns an empty dictionary.

Parameters:sent (list) – A part of speech tagged list of tokens representing a sentence
Returns:An object dictionary for the command - currently returns an empty dictionary under all inputs
Return type:dict
interpreter.extractor.object_dict_talk(sent)[source]

Extracts objects out of a sentence that contains talk as its action

Rules:

  1. The noun to come after the word about is the topic
  2. The noun to come after any preposition that is not about is the person
  3. Other nouns will be tagged as unknown

Objects:

  1. person - The person to talk to
  2. topic - The subject to talk about
  3. unknown - The role of this noun is not known
Parameters:sent (list) – A part of speech tagged list of tokens representing a sentence
Returns:An object dictionary for the command
Return type:dict
interpreter.extractor.object_dict_turn(sent)[source]

Extracts objects out of a sentence that contains turn as its action.

Currently uses the same rules as object_dict_move()

Parameters:sent (list) – A part of speech tagged list of tokens representing a sentence
Returns:An object dictionary for the command
Return type:dict