File size: 1,022 Bytes
7e24b41
 
 
 
 
1802405
 
 
 
 
 
 
 
 
7e24b41
 
 
 
 
1802405
 
 
 
 
 
 
 
 
7e24b41
 
 
 
 
1802405
 
 
 
 
 
 
 
 
7e24b41
 
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
32
33
34
35
36
37
38
39
40
41
42
43
44
import configparser
import string
import yaml

def getConfig(path: str):
    """

    Load configuration from a specified file.



    Args:

        path (str): The path to the configuration file.



    Returns:

        ConfigParser: The loaded configuration object.

    """
    config = configparser.ConfigParser()
    config.read(path)
    return config

def cleanText(text: str):
    """

    Clean the input text by removing newline characters and punctuation.



    Args:

        text (str): The text to be cleaned.



    Returns:

        str: The cleaned text.

    """
    text = text.replace("\n", " ")
    text = text.translate(str.maketrans('', '', string.punctuation.replace(".", "")))
    return text

def loadYaml(path: str):
    """

    Load YAML content from a specified file.



    Args:

        path (str): The path to the YAML file.



    Returns:

        dict: The parsed content of the YAML file.

    """
    with open(path) as file:
        return yaml.safe_load(file)