Beispiel #1
0
class CScorer:
    def __init__(self,
                 items,
                 level1=DEFAULT_LEVEL1,
                 level2=DEFAULT_LEVEL2,
                 level3=DEFAULT_LEVEL3):
        from calibre_extensions.matcher import Matcher
        self.m = Matcher(items,
                         primary_collator().capsule, str(level1), str(level2),
                         str(level3))

    def __call__(self, query):
        scores, positions = self.m.calculate_scores(query)
        yield from zip(scores, positions)
class CScorer(object):
    def __init__(self,
                 items,
                 level1=DEFAULT_LEVEL1,
                 level2=DEFAULT_LEVEL2,
                 level3=DEFAULT_LEVEL3):
        from calibre_extensions.matcher import Matcher
        self.m = Matcher(items,
                         primary_collator().capsule, unicode_type(level1),
                         unicode_type(level2), unicode_type(level3))

    def __call__(self, query):
        scores, positions = self.m.calculate_scores(query)
        for score, pos in zip(scores, positions):
            yield score, pos