def __init__(self, **kwargs): Provider.__init__(self, **kwargs) self._punctuation = re.compile("\W|_") self._strip_patterns = [re.compile(pattern) for pattern in [ r'\s*[\(\[{].*?[}\)\]]', # Strip everything in brackets ([{ r'\s*(cd|disc)\s*\d+' # remove CD <X> stuff. ]]
def __init__(self, **kwargs): Provider.__init__(self, **kwargs) self._punctuation = re.compile("\W|_") self._split_reasons = frozenset(['feat', 'featuring', 'and']) self._strip_patterns = [re.compile(pattern) for pattern in [ r'^the\s*', r'^a\s*', r'\s*of\s*' ]]
def __init__(self, provider_list, **kwargs): """Creates a proivder that applies subproviders in a certain order to it's input. :param provider_list: A ordered list of provider objects. """ self._provider_list = provider_list Provider.__init__(self, **kwargs)
def __init__(self, quality='all', **kwargs): """Creates a GenreTreeProvider with a certain quality. A GenreTreeProvider will try to normalize a genre by using a Tree of 705 single genres that will be matched with the input genre in a fast way. The result will be a list of Paths. A Path is a tuple of indices, representing a possible way through the Tree. For debugging purpose you can use GenreTreeProvider.resolve_path() on the path to get the full genre back. The Quality levels are: - ``all``: Try to find all possible paths through the Tree, sorted by the first index (which is useful for comparing.) - ``single``: Simply take the first possible path found. Fastest. - ``best_two``: Like list, but also uses the reverse word list in a second try. Might give better results than 'single' at the cost of some speed. Default is ``all``. This provider is reversible. :param quality: One of ``all``, ``best_two`` ``single`` [*default:* ``all``] :type quality: String """ Provider.__init__(self, **kwargs) self._root = load_genre_tree(get_cache_path('genre_tree.dump')) self._build_func = { 'all': build_genre_path_all, 'best_two': build_genre_path_best_of_two, 'single': build_genre_path_single }.get(quality, build_genre_path_all)
def __init__(self, provider_list, **kwargs): """Creates a proivder that applies subproviders in a certain order to it's input. :param provider_list: A ordered list of provider objects. """ self._provider_list = provider_list Provider.__init__(self, **kwargs)
def __init__(self, quality='all', **kwargs): """Creates a GenreTreeProvider with a certain quality. A GenreTreeProvider will try to normalize a genre by using a Tree of 705 single genres that will be matched with the input genre in a fast way. The result will be a list of Paths. A Path is a tuple of indices, representing a possible way through the Tree. For debugging purpose you can use GenreTreeProvider.resolve_path() on the path to get the full genre back. The Quality levels are: - ``all``: Try to find all possible paths through the Tree, sorted by the first index (which is useful for comparing.) - ``single``: Simply take the first possible path found. Fastest. - ``best_two``: Like list, but also uses the reverse word list in a second try. Might give better results than 'single' at the cost of some speed. Default is ``all``. This provider is reversible. :param quality: One of ``all``, ``best_two`` ``single`` [*default:* ``all``] :type quality: String """ Provider.__init__(self, **kwargs) self._root = load_genre_tree(get_cache_path('genre_tree.dump')) self._build_func = { 'all': build_genre_path_all, 'best_two': build_genre_path_best_of_two, 'single': build_genre_path_single }.get(quality, build_genre_path_all)
def __init__(self, **kwargs): Provider.__init__(self, **kwargs) self._punctuation = re.compile("\W|_") self._split_reasons = frozenset(['feat', 'featuring', 'and']) self._strip_patterns = [ re.compile(pattern) for pattern in [r'^the\s*', r'^a\s*', r'\s*of\s*'] ]
def __init__(self, **kwargs): if not HAS_PLYR: raise LookupError('Plyr could be imported, which is needed for lyrics') self._cache_failures = kwargs.pop('cache_failures', True) self.database = plyr.Database(get_cache_path(None)) Provider.__init__(self, **kwargs)
def __init__(self, use_cache=True, cache_fails=True, **kwargs): """ :param use_cache: Cache found results? :param cache_fails: Also cache missed results? """ Provider.__init__(self, **kwargs) self._use_cache, self._cache_fails = use_cache, cache_fails self._shelve = shelve.open(get_cache_path('discogs_genre.dump'), writeback=True)
def __init__(self, **kwargs): Provider.__init__(self, **kwargs) self._punctuation = re.compile("\W|_") self._strip_patterns = [ re.compile(pattern) for pattern in [ r'\s*[\(\[{].*?[}\)\]]', # Strip everything in brackets ([{ r'\s*(cd|disc)\s*\d+' # remove CD <X> stuff. ] ]
def __init__(self, use_cache=True, cache_fails=True, **kwargs): """ :param use_cache: Cache found results? :param cache_fails: Also cache missed results? """ Provider.__init__(self, **kwargs) self._use_cache, self._cache_fails = use_cache, cache_fails self._shelve = shelve.open( get_cache_path('discogs_genre.dump'), writeback=True )
def __init__(self, language='english', **kwargs): """ See here for a full list of languages: http://nltk.org/_modules/nltk/stem/snowball.html .. note:: This does not depend on nltk, it depends on the ``pystemmer`` package. :param language: language to use during stemming, defaults to english. """ Provider.__init__(self, **kwargs) self._stemmer = Stemmer(language)
def __init__(self, cache_invalid=False, **kwargs): """ :param cache_invalid: Also cache invalid results of failed calculations? """ Provider.__init__(self, **kwargs) self._cache_invalid = cache_invalid