Upload New File

parent 7a237235
class DataProcessor:
def __init__(self, model, storage):
self.model = model
self.storage = storage
def process(self, data):
processed_text = self._preprocess(data)
tokens = self.model.tokenize(processed_text)
category = self.model.classify(processed_text)
entities = self.model.extract_entities(processed_text)
result = {"tokens": tokens, "category": category, "entities": entities}
self.storage.save(result)
return result
def _preprocess(self, text):
return text.strip().lower()
class NLPModel:
def tokenize(self, text):
return text.split()
def classify(self, text):
return "UNKNOWN"
def extract_entities(self, text):
return []
class DataStorage:
def save(self, data):
print(f"Сохранено: {data}")
return True
def load(self):
return {}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment