From 029f41f0e630bbea421de109c9937008f1526067 Mon Sep 17 00:00:00 2001 From: James Briggs <35938317+jamescalam@users.noreply.github.com> Date: Tue, 7 Nov 2023 07:32:19 +0100 Subject: [PATCH] tweaks --- decision_layer/decision_layer.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/decision_layer/decision_layer.py b/decision_layer/decision_layer.py index 2dbfe4f6..2db8f07d 100644 --- a/decision_layer/decision_layer.py +++ b/decision_layer/decision_layer.py @@ -15,15 +15,13 @@ class DecisionLayer: for decision in decisions: self._add_decision(decision=decision) - def __call__(self, text: str): - + def __call__(self, text: str, _tan: bool=True, _threshold: float=0.5): results = self._query(text) - decision = self.simple_categorize(results) + decision = self._semantic_classify(results, apply_tan=_tan, threshold=_threshold) # return decision - raise NotImplementedError("To implement decision logic based on scores") - + return decision - def add(self, decision: Decision, dimensiona): + def add(self, decision: Decision): self._add_decision(devision=decision) def _add_decision(self, decision: Decision): @@ -60,8 +58,8 @@ class DecisionLayer: {"decision": d, "score": s.item()} for d, s in zip(decisions, scores) ] - def simple_classify(self, query_results: dict, apply_tan: bool=True): - """Given some text, categorises it based on the scores from _query.""" + def _semantic_classify(self, query_results: dict, apply_tan: bool=True, threshold: float=0.5): + """Given some text, categorizes.""" # apply the scoring system to the results and group by category scores_by_category = {} -- GitLab