Spaces:
Sleeping
Sleeping
Commit ·
892cd8f
1
Parent(s): e3dccb9
added commands to download nltk corpus such that local execution on other systems doesn't cause any issues
Browse files- environment.py +6 -2
environment.py
CHANGED
|
@@ -4,6 +4,10 @@ from models import Action, ActionType, Email, Observation, Reward
|
|
| 4 |
from data import TASK_CONFIGS
|
| 5 |
|
| 6 |
import nltk
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
from nltk.stem import PorterStemmer
|
| 8 |
from nltk.sentiment.vader import SentimentIntensityAnalyzer
|
| 9 |
from nltk.tokenize import word_tokenize
|
|
@@ -98,8 +102,8 @@ class EmailSortingEnvironment:
|
|
| 98 |
components: Dict[str, float] = {}
|
| 99 |
total = 0.0
|
| 100 |
|
| 101 |
-
cat_given = action.
|
| 102 |
-
urg_given = action.
|
| 103 |
|
| 104 |
if cat_given == email.get("correct_category"):
|
| 105 |
components["category_correct"] = 0.15
|
|
|
|
| 4 |
from data import TASK_CONFIGS
|
| 5 |
|
| 6 |
import nltk
|
| 7 |
+
|
| 8 |
+
nltk.download("vader_lexicon", quiet=True)
|
| 9 |
+
nltk.download("punkt_tab", quiet=True)
|
| 10 |
+
|
| 11 |
from nltk.stem import PorterStemmer
|
| 12 |
from nltk.sentiment.vader import SentimentIntensityAnalyzer
|
| 13 |
from nltk.tokenize import word_tokenize
|
|
|
|
| 102 |
components: Dict[str, float] = {}
|
| 103 |
total = 0.0
|
| 104 |
|
| 105 |
+
cat_given = action.category.value if action.category else None
|
| 106 |
+
urg_given = action.urgency.value if action.urgency else None
|
| 107 |
|
| 108 |
if cat_given == email.get("correct_category"):
|
| 109 |
components["category_correct"] = 0.15
|