Exemplo n.º 1
0
 def __init__(self,
              collection,
              dataset,
              tagrelMethod,
              tpp='lemm',
              rootpath=ROOT_PATH):
     TagBasedSearchEngine.__init__(self, collection, dataset, tpp, rootpath)
     self.rawtagnumreader = AttributeReader(collection, "rawtagnum",
                                            rootpath)
     self.reader = TagrankReader(collection, dataset, tagrelMethod,
                                 rootpath)
     self.name = "%s(%s)" % (self.__class__.__name__, self.reader.name)
     self.outputdir = os.path.join(self.outputdir, 'tagrank', tagrelMethod)
Exemplo n.º 2
0
class TagrankSearchEngine (TagBasedSearchEngine):

    def __init__(self, collection, dataset, tagrelMethod, tpp='lemm', rootpath=ROOT_PATH):
        TagBasedSearchEngine.__init__(self, collection, dataset, tpp, rootpath)
        self.rawtagnumreader = AttributeReader(collection, "rawtagnum", rootpath)
        self.reader = TagrankReader(collection, dataset, tagrelMethod, rootpath)
        self.name = "%s(%s)" % (self.__class__.__name__, self.reader.name)
        self.outputdir = os.path.join(self.outputdir, 'tagrank', tagrelMethod)
        
    def computeScore(self, concept, photoid):
        rawtagnum = self.rawtagnumreader.get(photoid)
        rank = self.reader.get(photoid,concept)
        return -rank + (1.0/rawtagnum)
Exemplo n.º 3
0
class TagrankSearchEngine(TagBasedSearchEngine):
    def __init__(self,
                 collection,
                 dataset,
                 tagrelMethod,
                 tpp='lemm',
                 rootpath=ROOT_PATH):
        TagBasedSearchEngine.__init__(self, collection, dataset, tpp, rootpath)
        self.rawtagnumreader = AttributeReader(collection, "rawtagnum",
                                               rootpath)
        self.reader = TagrankReader(collection, dataset, tagrelMethod,
                                    rootpath)
        self.name = "%s(%s)" % (self.__class__.__name__, self.reader.name)
        self.outputdir = os.path.join(self.outputdir, 'tagrank', tagrelMethod)

    def computeScore(self, concept, photoid):
        rawtagnum = self.rawtagnumreader.get(photoid)
        rank = self.reader.get(photoid, concept)
        return -rank + (1.0 / rawtagnum)
Exemplo n.º 4
0
 def __init__(self, collection, dataset, tagrelMethod, tpp='lemm', rootpath=ROOT_PATH):
     TagBasedSearchEngine.__init__(self, collection, dataset, tpp, rootpath)
     self.rawtagnumreader = AttributeReader(collection, "rawtagnum", rootpath)
     self.reader = TagrankReader(collection, dataset, tagrelMethod, rootpath)
     self.name = "%s(%s)" % (self.__class__.__name__, self.reader.name)
     self.outputdir = os.path.join(self.outputdir, 'tagrank', tagrelMethod)