Spaces:
Sleeping
Sleeping
Commit
·
f1e80f2
1
Parent(s):
d576847
included examples in description
Browse files- absa_evaluator.py +17 -2
absa_evaluator.py
CHANGED
|
@@ -14,7 +14,7 @@ _CITATION = """
|
|
| 14 |
_DESCRIPTION = """
|
| 15 |
This module provides evaluation metrics for Aspect-Based Sentiment Analysis (ABSA).
|
| 16 |
The metrics include precision, recall, and F1 score for both aspect terms and category detection.
|
| 17 |
-
Additionally it calculates
|
| 18 |
ABSA evaluates the capability of a model to identify and correctly classify the sentiment of specific aspects within a text.
|
| 19 |
"""
|
| 20 |
|
|
@@ -30,6 +30,21 @@ Args:
|
|
| 30 |
- 'category': Category
|
| 31 |
- 'polarity': polarity of the category
|
| 32 |
references: List of ABSA references with the same structure as predictions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
Returns:
|
| 34 |
term_extraction_results: f1 score, precision and recall for aspect terms
|
| 35 |
term_polarity_results_accuracy: accuracy for polarities on aspect terms
|
|
@@ -144,7 +159,7 @@ class AbsaEvaluator(evaluate.Metric):
|
|
| 144 |
Returns:
|
| 145 |
- A dictionary containing the precision, recall, F1 score, and counts of common, retrieved, and relevant.
|
| 146 |
|
| 147 |
-
link for
|
| 148 |
"""
|
| 149 |
b = 1
|
| 150 |
common, relevant, retrieved = 0.0, 0.0, 0.0
|
|
|
|
| 14 |
_DESCRIPTION = """
|
| 15 |
This module provides evaluation metrics for Aspect-Based Sentiment Analysis (ABSA).
|
| 16 |
The metrics include precision, recall, and F1 score for both aspect terms and category detection.
|
| 17 |
+
Additionally it calculates the accuracy for polarities from aspect terms and category detection.
|
| 18 |
ABSA evaluates the capability of a model to identify and correctly classify the sentiment of specific aspects within a text.
|
| 19 |
"""
|
| 20 |
|
|
|
|
| 30 |
- 'category': Category
|
| 31 |
- 'polarity': polarity of the category
|
| 32 |
references: List of ABSA references with the same structure as predictions.
|
| 33 |
+
|
| 34 |
+
Examples for predictions:
|
| 35 |
+
[
|
| 36 |
+
{
|
| 37 |
+
"aspects": [
|
| 38 |
+
{"term": "battery life", "polarity": "positive"},
|
| 39 |
+
{"term": "camera", "polarity": "negative"}
|
| 40 |
+
],
|
| 41 |
+
"category": [
|
| 42 |
+
{"category": "Battery", "polarity": "positive"},
|
| 43 |
+
{"category": "Camera", "polarity": "negative"}
|
| 44 |
+
]
|
| 45 |
+
}
|
| 46 |
+
]
|
| 47 |
+
|
| 48 |
Returns:
|
| 49 |
term_extraction_results: f1 score, precision and recall for aspect terms
|
| 50 |
term_polarity_results_accuracy: accuracy for polarities on aspect terms
|
|
|
|
| 159 |
Returns:
|
| 160 |
- A dictionary containing the precision, recall, F1 score, and counts of common, retrieved, and relevant.
|
| 161 |
|
| 162 |
+
link for this code: https://github.com/davidsbatista/Aspect-Based-Sentiment-Analysis/blob/1d9c8ec1131993d924e96676fa212db6b53cb870/libraries/baselines.py#L387
|
| 163 |
"""
|
| 164 |
b = 1
|
| 165 |
common, relevant, retrieved = 0.0, 0.0, 0.0
|