(hypothesis, reference)
| 7 | import jieba # you can use any other word cutting library |
| 8 | |
| 9 | def 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 | |
| 21 | def parse_function_call(function_call): |
| 22 | pattern = r"(\w+)\((.*)\)" |