Learn R Programming

stoRy (version 0.1.5)

get_similar_stories: Recommend stories similar to a user-selected one.

Description

get_similar_stories returns a list of stories, sorted by thematic similarity with respect to a user-selected story

Usage

get_similar_stories(
  mystory,
  background_storyset = c("tos", "tas", "tng", "voy"),
  theme_levels = c("central", "peripheral"),
  similarity_function = c("cosine", "cosine tf-idf", "soft cardinality"),
  blacklist = ""
)

Arguments

mystory

A story class object.

background_storyset

default c("tos", "tas", "tng", "voy"). A string indicating the storyset to use as background. Possible values are c("tos", "tas"), "tng", "voy", and c("tos", "tas", "tng", "voy").

theme_levels

default c("central", "peripheral"). A string indicating the theme levels to use in the analysis. Possible values are "central", "peripheral", and c("central", "peripheral").

similarity_function

default "cosine". Possible values are "cosine", "cosine tf-idf", and c("soft cardinality").

blacklist

default "". A vector of blacklisted themes.

Value

Returns a data frame where each row corresponds to a story. The column SimilarityScore contains scores indicating story similarity to the selected story.

References

Sheridan, P., Onsj<U+00F6>, M., and Jim<U+00E9>nez, S. (2018): "A Content-based Filtering Story Recommender System for Theme Lovers with an Application to the Star Trek Television Franchise", ArXiv.

Examples

Run this code
# NOT RUN {
#######################################################################
# Recommend Star Trek stories similar to the Star Trek: Voyager       #
# episode False Profits (voy3x05)                                     #
#######################################################################
# }
# NOT RUN {
story_id <- "voy3x05"
mystory <- story$new(story_id)
result <- get_similar_stories(mystory)
# }
# NOT RUN {
#######################################################################
# Output top ten most similar stories                                 #
#######################################################################
# }
# NOT RUN {
result[1:10,]
# }

Run the code above in your browser using DataLab