Delete data_loader.py
Browse files- data_loader.py +0 -31
data_loader.py
DELETED
|
@@ -1,31 +0,0 @@
|
|
| 1 |
-
import configparser
|
| 2 |
-
import json
|
| 3 |
-
def get_config():
|
| 4 |
-
# Read config
|
| 5 |
-
config = configparser.ConfigParser()
|
| 6 |
-
config.read(r"C:\Users\kbuzlu\PycharmProjects\SentimentIntentionAnalysis\config\config.ini")
|
| 7 |
-
|
| 8 |
-
# Get model_name
|
| 9 |
-
model_name = config["model"]["name"]
|
| 10 |
-
|
| 11 |
-
# Get data path
|
| 12 |
-
data_path = config["data"]["data_dir"]
|
| 13 |
-
|
| 14 |
-
# Get possible labels
|
| 15 |
-
labels_path = config["data"]["possible_labels_dir"]
|
| 16 |
-
return model_name, data_path, labels_path
|
| 17 |
-
|
| 18 |
-
def load_data(data_path):
|
| 19 |
-
# Load data
|
| 20 |
-
with open(data_path, "r") as file:
|
| 21 |
-
data = json.load(file)
|
| 22 |
-
texts = [entry["text"] for entry in data]
|
| 23 |
-
return texts
|
| 24 |
-
|
| 25 |
-
def load_labels(labels_path):
|
| 26 |
-
# Load labels
|
| 27 |
-
with open(labels_path, "r") as file:
|
| 28 |
-
data = json.load(file)
|
| 29 |
-
sentiment_labels = data["sentiment_labels"]
|
| 30 |
-
intention_labels = data["intention_labels"]
|
| 31 |
-
return sentiment_labels, intention_labels
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|