Spaces:
Sleeping
Sleeping
HalteroXHunter
commited on
Commit
·
12c1471
1
Parent(s):
f8130b1
update info
Browse files- absa_evaluator.py +13 -9
absa_evaluator.py
CHANGED
@@ -12,29 +12,33 @@ _CITATION = """
|
|
12 |
"""
|
13 |
|
14 |
_DESCRIPTION = """
|
15 |
-
|
|
|
|
|
|
|
16 |
"""
|
17 |
|
18 |
_KWARGS_DESCRIPTION = """
|
19 |
-
Computes precision, recall, and F1 score for aspect terms and
|
20 |
|
21 |
Args:
|
22 |
predictions: List of ABSA predictions with the following structure:
|
23 |
- 'aspects': Sequence of aspect annotations, each with the following keys:
|
24 |
- 'term': Aspect term
|
25 |
- 'polarity': Polarity of the aspect term
|
|
|
|
|
|
|
26 |
references: List of ABSA references with the same structure as predictions.
|
27 |
Returns:
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
polarity_recall: Recall score for aspect polarities
|
33 |
-
polarity_f1: F1 score for aspect polarities
|
34 |
"""
|
35 |
|
36 |
|
37 |
-
class
|
38 |
def _info(self):
|
39 |
return evaluate.MetricInfo(
|
40 |
description=_DESCRIPTION,
|
|
|
12 |
"""
|
13 |
|
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 de 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 |
|
21 |
_KWARGS_DESCRIPTION = """
|
22 |
+
Computes precision, recall, and F1 score for aspect terms and category detection in Aspect-Based Sentiment Analysis (ABSA). Also calculates de accuracy for polarities on each task.
|
23 |
|
24 |
Args:
|
25 |
predictions: List of ABSA predictions with the following structure:
|
26 |
- 'aspects': Sequence of aspect annotations, each with the following keys:
|
27 |
- 'term': Aspect term
|
28 |
- 'polarity': Polarity of the aspect term
|
29 |
+
- 'category': Sequence of category annotations, each with the following keys:
|
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
|
36 |
+
category_detection_results: f1 score, precision and recall for category detection
|
37 |
+
category_polarity_results_accuracy: accuracy for polarities on categories
|
|
|
|
|
38 |
"""
|
39 |
|
40 |
|
41 |
+
class AbsaEvaluator(evaluate.Metric):
|
42 |
def _info(self):
|
43 |
return evaluate.MetricInfo(
|
44 |
description=_DESCRIPTION,
|