Skip to content
Snippets Groups Projects
Commit 7b535840 authored by dmt's avatar dmt
Browse files

Add destruction settings and add 'knowledge_dir' as config parameter.

parent 4c120bb8
No related branches found
No related tags found
No related merge requests found
......@@ -56,11 +56,11 @@ class Settings(metaclass=MetaSettings):
LEARN_DIR: str = ""
MAX_LEARN_DIR: int = 0
USE_EXISTING_MODELS: bool = False
SET_FEATURES: str = ""
KNOWLEDGE_DIR = ""
SET_TARGETS: str = ""
SORT_TIME_STAMP: bool = False
CUT_TIME_STAMP: bool = False
BLOCK_SIZE: int = 0
MAX_BLOCKS: int = 0
STACK_ITERATIONS: int = 0
LEARN_BLOCK_MINIMUM: int = 0
......@@ -85,15 +85,20 @@ class PreprocessingSettings:
@dataclass
class BlockProcessingSettings:
block_size = int
max_blocks = int
stack_iterations = int
learn_block_minimum = int
sigma_zeta_cutoff = float
block_size: int
max_blocks: int
stack_iterations: int
learn_block_minimum: int
sigma_zeta_cutoff: float
@dataclass
class DeconstructionSettings:
pass
def specific_settings_factory(settings_type: str):
types = {
factory = {
"general": starmap(
GeneralSettings, [(Settings.INPUT_FILE,
Settings.LEARN_DIR,
......@@ -109,15 +114,19 @@ def specific_settings_factory(settings_type: str):
Settings.MAX_BLOCKS,
Settings.STACK_ITERATIONS,
Settings.LEARN_BLOCK_MINIMUM,
Settings.SIGMA_ZETA_CUTOFF)])
Settings.SIGMA_ZETA_CUTOFF)]),
"deconstruction": starmap(
DeconstructionSettings, [()]
)
}
return next(types[settings_type])
return next(factory[settings_type])
def read_settings(path: str):
try:
config = ConfigParser(path)
config = ConfigParser()
config.read(path)
configure_main_settings_class(config)
except AttributeError as e:
# TODO (dmt): Implement proper error handling.
......@@ -126,11 +135,12 @@ def read_settings(path: str):
def configure_main_settings_class(config):
default = config["DEFAULT"]
default = config["GENERAL"]
Settings.INPUT_FILE = default["input_file"]
Settings.LEARN_DIR = default["learn_dir"]
Settings.MAX_LEARN_DIR = default["max_learn_dir"]
Settings.USE_EXISTING_MODELS = default["use_existing_models"]
Settings.KNOWLEDGE_DIR = default["knowledge_dir"]
preprocessing = config["PREPROCESSING"]
Settings.SET_FEATURES = preprocessing["set_features"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment