瀏覽代碼

score_list接口

罗俊辉 10 月之前
父節點
當前提交
1c20d1b195
共有 2 個文件被更改,包括 23 次插入23 次删除
  1. 22 22
      routes/accountServer.py
  2. 1 1
      test/score_list_dev.py

+ 22 - 22
routes/accountServer.py

@@ -103,28 +103,28 @@ class AccountServer(object):
         获取和单个账号的相关性分数
         :return:
         """
-        try:
-            account_interest, account_weight = await self.getAccountInterest(
-                account_name=account_name,
-                method=self.interest_type,
-            )
-            response = await self.request_for_nlp(
-                title_list=self.title_list,
-                account_interest=account_interest,
-                account_weight=account_weight,
-            )
-            res = response.json()
-            sim_key = "score_list_mean" if self.sim_type == "mean" else "score_list_avg"
-            return {
-                "score_list": res[sim_key],
-                "text_list_max": res["text_list_max"],
-            }
-        except Exception as e:
-            print(e)
-            return {
-                "score_list": [0] * len(self.title_list),
-                "text_list_max": self.title_list,
-            }
+        # try:
+        account_interest, account_weight = await self.getAccountInterest(
+            account_name=account_name,
+            method=self.interest_type,
+        )
+        response = await self.request_for_nlp(
+            title_list=self.title_list,
+            account_interest=account_interest,
+            account_weight=account_weight,
+        )
+        res = response.json()
+        sim_key = "score_list_mean" if self.sim_type == "mean" else "score_list_avg"
+        return {
+            "score_list": res[sim_key],
+            "text_list_max": res["text_list_max"],
+        }
+        # except Exception as e:
+        #     print(e)
+        #     return {
+        #         "score_list": [0] * len(self.title_list),
+        #         "text_list_max": self.title_list,
+        #     }
 
     async def getAccountListScoreList(self):
         """

+ 1 - 1
test/score_list_dev.py

@@ -11,7 +11,7 @@ class ArticleRank(object):
     账号排序
     """
     url = "http://192.168.100.31:8179/score_list"
-    url1 = "http://192.168.100.31:8179/score_list"
+    url1 = "http://47.98.154.124:6060/score_list"
 
     @classmethod
     def rank(cls, account_list, text_list):