Example #1
0
    def get(self):
        n = int(self.get_query_argument('docTopN'))
        txt = self.get_query_argument('words')
        logger.info(u'#####收到请求,参数:%s,%s' % (n, txt))
        unit_type = self.get_query_argument('type')
        province = self.get_query_argument('province')
        field = self.get_query_argument('field')
        unit = self.get_query_argument('unit')
        journalQuality = self.get_query_argument('journalQuality')

        recmder.set_ef('paper', ef_paper)
        recmder.set_ef('patent', ef_patent)
        recmder.set_ef('project', ef_project)

        try:
            ann_time = time.time()
            l = recmder.most_similar_paper(txt, TOPN)
            logger.info(u'time in paper ann ' + str(time.time() - ann_time))
        except:
            l = []
        filterParams = [field, unit_type, province, unit, journalQuality]
        begin = time.time()
        l = recmder.filter('paper', l, filterParams, n)
        end = time.time()
        logger.info(u'time in filter ' + str(end - begin))
        self.write(utils.l2m_str(l))
Example #2
0
 def get(self):
     n = int(self.get_query_argument('docTopN'))
     txt = self.get_query_argument('words')
     logger.info(u'#####收到请求,参数:%s,%s' % (n, txt))
     unit_type = self.get_query_argument('type')
     province = self.get_query_argument('province')
     field = self.get_query_argument('field')
     unit = self.get_query_argument('unit')
     patentType = self.get_query_argument('patentType')
     TOPN = 20
     try:
         ann_1 = time.time()
         l = recmder.field_deliver('patent', txt, TOPN, field, unit_type, province)
         ann_2 = time.time()
         logger.info(u'time in patent ann ' + str(ann_2 - ann_1))
     except:
         l = []
     filterParams = ['-1', '-1', '-1', unit, patentType]
     for i in range(len(filterParams)):
         if filterParams[i] == '-1':
             filterParams[i] = ''
     begin = time.time()
     l = recmder.filter('patent', l, filterParams, n)
     end = time.time()
     logger.info(u'time in filter' + str(end - begin))
     self.write(utils.l2m_str(l))
Example #3
0
 def get(self):
     n = int(self.get_query_argument('docTopN'))
     txt = self.get_query_argument('words')
     unit_type = self.get_query_argument('type')
     province = self.get_query_argument('province')
     unit = self.get_query_argument('unit')
     projectType = self.get_query_argument('projectType')
     try:
         ann_time = time.time()
         l = recmder.most_similar_project(txt, TOPN_project)
         logger.info(u'time in project ann ' + str(time.time() - ann_time))
     except:
         l = []
     filterParams = ['Z9', unit_type, province, unit, projectType]
     for i in range(len(filterParams)):
         if filterParams[i] == '-1':
             filterParams[i] = ''
     begin = time.time()
     l = recmder.filter('project', l, filterParams, n)
     end = time.time()
     logger.info(u'time in filter' + str(end - begin))
     self.write(utils.l2m_str(l))
Example #4
0
 def get(self):
     n = int(self.get_query_argument('docTopN'))
     txt = self.get_query_argument('words')
     logger.info(u'#####收到请求,参数:%s,%s' % (n, txt))
     unit_type = self.get_query_argument('type')
     province = self.get_query_argument('province')
     field = self.get_query_argument('field')
     unit = self.get_query_argument('unit')
     journalQuality = self.get_query_argument('journalQuality')
     TOPN = 20
     try:
         ann_1 = time.time()
         l = recmder.field_deliver('paper', txt, TOPN, field, unit_type, province)
         ann_2 = time.time()
         logger.info(u'time in paper ann ' + str(ann_2 - ann_1))
     except:
         l = []
     filterParams = ['-1', '-1', '-1', unit, journalQuality]
     begin = time.time()
     l = recmder.filter('paper', l, filterParams, n)
     end = time.time()
     logger.info(u'time in filter ' + str(end - begin))
     self.write(utils.l2m_str(l))