Zongxia Li
commited on
Update README.md
Browse files
README.md
CHANGED
|
@@ -72,17 +72,27 @@ F1 Match: False
|
|
| 72 |
'''
|
| 73 |
```
|
| 74 |
|
| 75 |
-
#### PANDA
|
| 76 |
```python
|
| 77 |
-
from qa_metrics.
|
| 78 |
|
| 79 |
question = "Which movie is loosley based off the Brother Grimm's Iron Henry?"
|
| 80 |
-
|
| 81 |
-
scores =
|
| 82 |
-
|
| 83 |
-
|
|
|
|
|
|
|
| 84 |
'''
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
'''
|
| 87 |
```
|
| 88 |
|
|
|
|
| 72 |
'''
|
| 73 |
```
|
| 74 |
|
| 75 |
+
#### PANDA Match
|
| 76 |
```python
|
| 77 |
+
from qa_metrics.pedant import PEDANT
|
| 78 |
|
| 79 |
question = "Which movie is loosley based off the Brother Grimm's Iron Henry?"
|
| 80 |
+
pedant = PEDANT()
|
| 81 |
+
scores = pedant.get_scores(reference_answer, candidate_answer, question)
|
| 82 |
+
max_pair, highest_scores = pedant.get_highest_score(reference_answer, candidate_answer, question)
|
| 83 |
+
match_result = pedant.evaluate(reference_answer, candidate_answer, question)
|
| 84 |
+
print("Max Pair: %s; Highest Score: %s" % (max_pair, highest_scores))
|
| 85 |
+
print("Score: %s; PANDA Match: %s" % (scores, match_result))
|
| 86 |
'''
|
| 87 |
+
Max Pair: ('the princess and the frog', 'The movie "The Princess and the Frog" is loosely based off the Brother Grimm\'s "Iron Henry"'); Highest Score: 0.854451712151719
|
| 88 |
+
Score: {'the frog prince': {'The movie "The Princess and the Frog" is loosely based off the Brother Grimm\'s "Iron Henry"': 0.7131625951317375}, 'the princess and the frog': {'The movie "The Princess and the Frog" is loosely based off the Brother Grimm\'s "Iron Henry"': 0.854451712151719}}; PANDA Match: True
|
| 89 |
+
'''
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
```python
|
| 93 |
+
print(pedant.get_score(reference_answer[1], candidate_answer, question))
|
| 94 |
+
'''
|
| 95 |
+
0.7122460127464126
|
| 96 |
'''
|
| 97 |
```
|
| 98 |
|