Commit 28865b74 authored by Christof Walther's avatar Christof Walther Committed by Patrick Schlindwein
Browse files

feat: If applied, this commit will add basic intent similarity analysis structures and tests.

GitLab issue #3 "SpaCy - Ähnlichkeit der generierten ID"
parent 4abc0a51
from abc import ABC, abstractmethod
#interface for summary strategies
class ISummaryStrategy(ABC):
#id of the suammary strategy
def id(self):
raise NotImplementedError
#summarizes a text
def summarize(self, text: str) -> str:
raise NotImplementedError
\ No newline at end of file
from app.summary.summary_strategy_interface import ISummaryStrategy
from unittest import TestCase
#valid implementation of ISummaryStrategy
class TestImplementationValid(ISummaryStrategy):
id = "id1"
def summarize(self, text:str) -> str:
return text
#invalid implementation of ISummaryStrategy, missing id definition
class TestImplementationInvalidOne(ISummaryStrategy):
def summarize(self, text:str) -> str:
return text
#actual test case
class TestISummaryStrategy(TestCase):
def test_valid_implementation(self):
#init test data
test_text = "this is a test text"
test_id = "id1"
#run test functions
ti = TestImplementationValid()
summary = ti.summarize(test_text)
#assert result
self.assertEqual(summary, test_text)
self.assertEqual(, test_id)
def test_invalid_implementation_1(self):
#run test functions
excepted = False
ti = TestImplementationInvalidOne()
except NotImplementedError:
excepted = True
#assert result
\ No newline at end of file
......@@ -61,4 +61,4 @@ class IntentHandler:
# """
# # text = re.sub('<[^>]*>', '', text) to remove html tags
# text = re.sub('[\W]+', '', text.lower())
# return text
\ No newline at end of file
# return text
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