|
|
@@ -0,0 +1,37 @@
|
|
|
+import requests
|
|
|
+import uuid
|
|
|
+from openpyxl import load_workbook
|
|
|
+
|
|
|
+wb = load_workbook('./data/样本数据打标结果-12w-终版.xlsx')
|
|
|
+ws = wb.active
|
|
|
+for row in ws.iter_rows(min_row=2, values_only=True):
|
|
|
+ zhiye = row[0] if row[0] is not None else ""
|
|
|
+ touxiang = row[1] if row[1] is not None else ""
|
|
|
+ yongtu = row[2] if row[2] is not None else ""
|
|
|
+ phrase = f"职业:{zhiye} 投向:{touxiang} 用途:{yongtu}"
|
|
|
+ res = requests.post("http://10.192.72.13:9876/api/aitag/v1/tagging", json={
|
|
|
+ "esb_seq_no": uuid.uuid4().hex,
|
|
|
+ "business_attr": uuid.uuid4().hex,
|
|
|
+ "phrase": phrase
|
|
|
+ })
|
|
|
+ print(f"输入: {phrase},输出: {res.json()}")
|
|
|
+
|
|
|
+
|
|
|
+#批量读取test_data.txt中的测试用例,并调用接口进行测试
|
|
|
+# with open("样本数据打标结果-12w-终版.xlsx", "r", encoding="utf-8") as f:
|
|
|
+# for line in f:
|
|
|
+# phrase = line.strip().split(" ")
|
|
|
+# if len(phrase) < 2:
|
|
|
+# continue
|
|
|
+# if len(phrase) ==2:
|
|
|
+# phrase = "职业:"+phrase[0]+" "+"投向:"+phrase[1]
|
|
|
+# if len(phrase) == 3:
|
|
|
+# phrase = "职业:"+phrase[0]+" "+"投向:"+phrase[1]+" "+"用途:"+phrase[2]
|
|
|
+
|
|
|
+# res = requests.post("http://10.192.72.13:9876/api/aitag/v1/tagging", json={
|
|
|
+# "esb_seq_no": uuid.uuid4().hex,
|
|
|
+# "business_attr": uuid.uuid4().hex,
|
|
|
+# "phrase": phrase
|
|
|
+# })
|
|
|
+
|
|
|
+
|