Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -95,6 +95,8 @@ class AspectSentimentPipeline(Pipeline):
|
|
| 95 |
aspects = []
|
| 96 |
current_aspect = []
|
| 97 |
|
|
|
|
|
|
|
| 98 |
for token, prediction in zip(aligned_tokens, aligned_predictions):
|
| 99 |
if prediction == "B-A":
|
| 100 |
if current_aspect:
|
|
@@ -104,6 +106,8 @@ class AspectSentimentPipeline(Pipeline):
|
|
| 104 |
elif prediction == "I-A":
|
| 105 |
if current_aspect:
|
| 106 |
current_aspect.append(token)
|
|
|
|
|
|
|
| 107 |
else:
|
| 108 |
if current_aspect:
|
| 109 |
aspects.append(" ".join(current_aspect))
|
|
|
|
| 95 |
aspects = []
|
| 96 |
current_aspect = []
|
| 97 |
|
| 98 |
+
special_characters = ["+", "'"]
|
| 99 |
+
|
| 100 |
for token, prediction in zip(aligned_tokens, aligned_predictions):
|
| 101 |
if prediction == "B-A":
|
| 102 |
if current_aspect:
|
|
|
|
| 106 |
elif prediction == "I-A":
|
| 107 |
if current_aspect:
|
| 108 |
current_aspect.append(token)
|
| 109 |
+
elif token in special_characters and current_aspect:
|
| 110 |
+
current_aspect[-1] += token
|
| 111 |
else:
|
| 112 |
if current_aspect:
|
| 113 |
aspects.append(" ".join(current_aspect))
|