Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)