MCPcopy
hub / github.com/Turing-Project/WriteGPT / get_value

Function get_value

ScoringNetwork/utils.py:13–29  ·  view source on GitHub ↗

�������úͻ�ȡ�������

(assess_token, text)

Source from the content-addressed store, hash-verified

11
12
13def get_value(assess_token, text):
14 """
15 �������úͻ�ȡ�������
16 """
17 # assess_token = '24.21c5c0b1e62afccec4c444614fc8ea9f.2592000.1546754443.282335-15082009'
18 url = 'https://aip.baidubce.com/rpc/2.0/nlp/v2/dnnlm_cn?access_token=' + str(assess_token)
19 data = {"text":text}
20 data = json.dumps(data).encode('gbk')
21 request = urllib.request.Request(url, data)
22 request.add_header('Content-Type', 'application/json')
23 response = urllib.request.urlopen(request).read()
24 result = str(response, encoding="gbk")
25 # �����Զ�����Ҫ�Ľ��
26# filter_str = re.compile('ppl": (.*)')
27# value = re.findall(filter_str,str(response))
28# return float(str(value)[2:-4])
29 return result

Callers 1

DNN_Scorer.pyFile · 0.85

Calls 1

encodeMethod · 0.45

Tested by

no test coverage detected