MCPcopy Create free account
hub / github.com/THUDM/AutoWebGLM / get_rouge_score

Function get_rouge_score

eval.py:9–19  ·  view source on GitHub ↗
(hypothesis, reference)

Source from the content-addressed store, hash-verified

7import jieba # you can use any other word cutting library
8
9def get_rouge_score(hypothesis, reference):
10 if hypothesis is None or reference is None:
11 return None
12
13 hypothesis = ' '.join(jieba.cut(hypothesis))
14 reference = ' '.join(jieba.cut(reference))
15
16 rouge = Rouge()
17 scores = rouge.get_scores(hypothesis, reference)
18
19 return scores[0]["rouge-1"]['f']
20
21def parse_function_call(function_call):
22 pattern = r"(\w+)\((.*)\)"

Callers 1

eval.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected