def test_improvements(self): """A place to put tests for miscellaneous improvements added since the original work. """ # was Literary Fiction assert classifier.Science_Fiction == Keyword.genre( None, "Science Fiction - General") # Was General Fiction (!) assert classifier.Science_Fiction == Keyword.genre( None, "Science Fiction") assert classifier.Science_Fiction == Keyword.genre( None, "Speculative Fiction") assert classifier.Social_Sciences == Keyword.genre( None, "Social Sciences") assert classifier.Social_Sciences == Keyword.genre( None, "Social Science") assert classifier.Social_Sciences == Keyword.genre( None, "Human Science") # was genreless assert classifier.Short_Stories == Keyword.genre(None, "Short Stories") # was Military History assert classifier.Military_SF == Keyword.genre(None, "Interstellar Warfare") # was Fantasy assert classifier.Games == Keyword.genre( None, "Games / Role Playing & Fantasy") # This isn't perfect but it covers most cases. assert classifier.Media_Tie_in_SF == Keyword.genre( None, "TV, Movie, Video game adaptations") # Previously only 'nonfiction' was recognized. assert False == Keyword.is_fiction(None, "Non-Fiction") assert False == Keyword.is_fiction(None, "Non Fiction") # "Historical" on its own means historical fiction, but a # string containing "Historical" does not mean anything in # particular. assert classifier.Historical_Fiction == Keyword.genre( None, "Historical") assert None == Keyword.genre(None, "Historicals") # The Fiction/Urban classification is different from the # African-American-focused "Urban Fiction" classification. assert None == Keyword.genre(None, "Fiction/Urban") assert classifier.Folklore == Keyword.genre(None, "fables")
def genre(self, keyword): scrub = Keyword.scrub_identifier(keyword) fiction = Keyword.is_fiction(None, scrub) audience = Keyword.audience(None, scrub) return Keyword.genre(None, scrub, fiction, audience)