def genre(cls, identifier, name, fiction=None, audience=None, **kwargs): if fiction and identifier in cls.fiction_genres: return cls.fiction_genres[identifier] if identifier in cls.genres: return cls.genres[identifier] return KeywordBasedClassifier.genre( identifier, name, fiction, audience, **kwargs )
def genre(cls, identifier, name, fiction, audience): for ruleset in cls.GENRE: genre = ruleset.match(*name) if genre is cls.stop: return None if genre is not None: return genre # If all else fails, try a keyword-based classifier. keyword = "/".join(name) return KeywordBasedClassifier.genre(identifier, keyword, fiction, audience)
def genre(cls, identifier, name, fiction, audience): for ruleset in cls.GENRE: genre = ruleset.match(*name) if genre is cls.stop: return None if genre is not None: return genre # If all else fails, try a keyword-based classifier. keyword = "/".join(name) return KeywordBasedClassifier.genre( identifier, keyword, fiction, audience )