simulation.nlp.movies package

Submodules

simulation.nlp.movies.movies_nlg module

Simple NLG for the movie domain

Author: Krisztian Balog, Shuo Zhang

class simulation.nlp.movies.movies_nlg.MoviesNLG(response_template={'ask_genre': ['What is the genre?', 'How about the genre of this movie?'], 'ask_movie_about': ['What is this movie about?', 'What is it about?', 'Tell me more about it'], 'book_tickets': ['Can you book me tickets for {day} at {time}?', 'Please book it for me on {day} at {time}'], 'preference_actor_dislike': ["I don't want to watch movies with {actor}", "I don't like {actor}"], 'preference_actor_like': ['I like {actor}', '{actor} is one of my favorite movie stars!'], 'preference_genre_like': ['I like {genre} movies', 'I enjoy {genre} movies', 'I usually prefer to watch {genre} movies'], 'preference_movie_seen': ['I have seen it already', "This I've watched"]})

Bases: simulation.nlp.nlg.NLG

Movies NLG

generate_response_text(intent, arguments=None)
Parameters:
  • intent – agent intent
  • arguments

Returns: response text

simulation.nlp.movies.movies_nlu module

Simple NLU for the movie domain

Author: Shuo Zhang, Krisztian Balog

class simulation.nlp.movies.movies_nlu.MoviesNLU

Bases: simulation.nlp.nlu.NLU

Movies NLU

extract_sf(text)

Based on the recorded utterance patterns (cf. UTTERANCE_PATTERN), locate and extract surface forms for movie titles

Parameters:text – text

Returns: surface form

static find_pattern(utterance)

Finds the pattern by checking the prefix, i.e., checking the terms by splitting.

Parameters:utterance – agent utterrance

Returns: pattern

Links entities in the given text.

Parameters:text – text

Returns: linked movies

Links entity for the given surface form.

Parameters:
  • sf – surface form
  • id – id

Returns: linked movies

movie_genre(title)

Finds movie genre based on movie title.

Parameters:title – movie title

Returns: list of movie genre

naive_index()

Loads MovieLens dataset as local index.

Returns: movie lens indexes

static parse(text)

Removes special tags to avoid problems such as parenthesis matching in regex.

Parameters:text – text

Returns: parsed text

static text_prepare(doc)

Split the doc.

Parameters:doc – text

Returns: Splitted text

Module contents

NLP for movies

This nlp package provides classes for entity linking and natural language generation.

Author: Shuo Zhang