File size: 930 Bytes
618f37b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import configparser
import json
def get_config():
    # Read config
    config = configparser.ConfigParser()
    config.read(r"C:\Users\kbuzlu\PycharmProjects\SentimentIntentionAnalysis\config\config.ini")

    # Get model_name
    model_name = config["model"]["name"]

    # Get data path
    data_path = config["data"]["data_dir"]

    # Get possible labels
    labels_path = config["data"]["possible_labels_dir"]
    return model_name, data_path, labels_path

def load_data(data_path):
    # Load data
    with open(data_path, "r") as file:
        data = json.load(file)
    texts = [entry["text"] for entry in data]
    return texts

def load_labels(labels_path):
    # Load labels
    with open(labels_path, "r") as file:
        data = json.load(file)
    sentiment_labels = data["sentiment_labels"]
    intention_labels = data["intention_labels"]
    return sentiment_labels, intention_labels