File size: 1,849 Bytes
cd123bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from dataclasses import dataclass


@dataclass
class DatasetConfig:
    """
    Configuration class for dataset generation parameters
    
    Attributes:
        embedding_dim: Dimension for embedding layer output
        train_size: Number of samples in training set
        val_size: Number of samples in validation set
        test_size: Number of samples in test set
        random_state: Random seed for reproducibility
        min_word_freq: Minimum word frequency to include in vocabulary
        load_from_disk: Load dataset from local dir. If false download from huggin face
        path_to_data: Path to local dataset data
        max_seq_len: Maximum sequence length (will be padded/truncated to this)
        lowercase: Whether to convert text to lowercase
        remove_punct: Whether to remove punctuation
        pad_token: Padding token
        unk_token: Unknown token    
    """

    embedding_dim: int = 64
    train_size: int = 10000
    val_size: int = 5000
    test_size: int = 5000
    random_state: int = 42
    min_word_freq: int = 1
    load_from_disk: bool = False
    path_to_data: str = "./datasets"

    max_seq_len: int = 300
    lowercase: bool = True
    remove_punct: bool = False
    pad_token: str = "<PAD>"
    unk_token: str = "<UNK>"


@dataclass
class TextProcessorConfig:
    """
    Configuration class for text processor parameters (params should be equal dataset config)
    
    Attributes:
        max_seq_len: Maximum sequence length (will be padded/truncated to this)
        lowercase: Whether to convert text to lowercase
        remove_punct: Whether to remove punctuation
        pad_token: Padding token
        unk_token: Unknown token    
    """

    max_seq_len: int = 300
    lowercase: bool = True
    remove_punct: bool = False
    pad_token: str = "<PAD>"
    unk_token: str = "<UNK>"