aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/conventionalrp/extractors
diff options
context:
space:
mode:
Diffstat (limited to 'src/conventionalrp/extractors')
-rw-r--r--src/conventionalrp/extractors/__init__.py4
-rw-r--r--src/conventionalrp/extractors/base.py9
-rw-r--r--src/conventionalrp/extractors/rule_extractor.py24
3 files changed, 37 insertions, 0 deletions
diff --git a/src/conventionalrp/extractors/__init__.py b/src/conventionalrp/extractors/__init__.py
new file mode 100644
index 0000000..d27a5eb
--- /dev/null
+++ b/src/conventionalrp/extractors/__init__.py
@@ -0,0 +1,4 @@
+# FILE: /trpg-log-processor/trpg-log-processor/src/trpg_log_processor/extractors/__init__.py
+"""
+This file initializes the extractors module.
+""" \ No newline at end of file
diff --git a/src/conventionalrp/extractors/base.py b/src/conventionalrp/extractors/base.py
new file mode 100644
index 0000000..fc42f29
--- /dev/null
+++ b/src/conventionalrp/extractors/base.py
@@ -0,0 +1,9 @@
+class BaseExtractor:
+ def __init__(self):
+ self.rules = []
+
+ def extract(self, log_data):
+ raise NotImplementedError("Subclasses should implement this method.")
+
+ def load_rules(self, rules_source):
+ raise NotImplementedError("Subclasses should implement this method.") \ No newline at end of file
diff --git a/src/conventionalrp/extractors/rule_extractor.py b/src/conventionalrp/extractors/rule_extractor.py
new file mode 100644
index 0000000..78e8505
--- /dev/null
+++ b/src/conventionalrp/extractors/rule_extractor.py
@@ -0,0 +1,24 @@
+class BaseExtractor:
+ def extract(self):
+ raise NotImplementedError("This method should be overridden by subclasses.")
+
+ def load_rules(self, rules):
+ raise NotImplementedError("This method should be overridden by subclasses.")
+
+
+class RuleExtractor(BaseExtractor):
+ def __init__(self, config_file):
+ self.config_file = config_file
+ self.rules = self.load_rules_from_file()
+
+ def load_rules_from_file(self):
+ import json
+ with open(self.config_file, 'r') as file:
+ return json.load(file)
+
+ def extract(self):
+ # Implement rule extraction logic here
+ extracted_rules = []
+ for rule in self.rules:
+ extracted_rules.append(rule) # Placeholder for actual extraction logic
+ return extracted_rules \ No newline at end of file