From 4eb2cf13338a0180642b507cc16fc2ecc53a37da Mon Sep 17 00:00:00 2001 From: casparejensen Date: Mon, 18 Dec 2023 18:47:22 +0100 Subject: [PATCH] Changed main concept linking solution to untrained spacy --- concept_linking/main.py | 4 ++-- concept_linking/solutions/StringComparison/utils.py | 2 -- relation_extraction/relation_extractor.py | 3 ++- test/test_server/test_server.py | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/concept_linking/main.py b/concept_linking/main.py index 3e4a310..e9c7253 100644 --- a/concept_linking/main.py +++ b/concept_linking/main.py @@ -14,10 +14,10 @@ def entity_type_classification(input_data): #stringComparisonSolution(input_data) # Untrained Spacy - #untrainedSpacySolution(input_data) + untrainedSpacySolution(input_data) # PromptEngineering - perform_entity_type_classification(input_data) + #perform_entity_type_classification(input_data) # Machine Learning #predict(input_data) diff --git a/concept_linking/solutions/StringComparison/utils.py b/concept_linking/solutions/StringComparison/utils.py index dd04793..262328e 100644 --- a/concept_linking/solutions/StringComparison/utils.py +++ b/concept_linking/solutions/StringComparison/utils.py @@ -14,8 +14,6 @@ def translateWordToEn(word, language): from difflib import SequenceMatcher - - # returnerer en konstant mellem 0 og 1. 0 er et elendigt match, 1 er et eksakt match. def similar(a, b): return SequenceMatcher(None, a.lower(), b.lower()).ratio() diff --git a/relation_extraction/relation_extractor.py b/relation_extraction/relation_extractor.py index b9de9b8..5fb3d4f 100644 --- a/relation_extraction/relation_extractor.py +++ b/relation_extraction/relation_extractor.py @@ -1,8 +1,9 @@ # from relation_extraction.NaiveMVP.main import handle_relation_post_request +from relation_extraction.NaiveMVP.main import handle_relation_post_request from relation_extraction.multilingual.main import begin_relation_extraction class RelationExtractor(): @classmethod def begin_extraction(self, data): - # handle_relation_post_request(data) # Naive solution + handle_relation_post_request(data) # Naive solution begin_relation_extraction(data) # Multilingual solution diff --git a/test/test_server/test_server.py b/test/test_server/test_server.py index f4e8340..f94607d 100644 --- a/test/test_server/test_server.py +++ b/test/test_server/test_server.py @@ -10,8 +10,8 @@ def setUp(self): # Valid: authorized and correct format @patch('os.getenv', return_value="some_api_secret") # @patch('concept_linking.main.stringComparisonSolution', return_value=Mock()) - # @patch('concept_linking.main.untrainedSpacySolution', return_value=Mock()) - @patch('concept_linking.main.perform_entity_type_classification', return_value=Mock()) + @patch('concept_linking.main.untrainedSpacySolution', return_value=Mock()) + # @patch('concept_linking.main.perform_entity_type_classification', return_value=Mock()) # @patch('concept_linking.main.predict', return_value=Mock()) @patch('relation_extraction.relation_extractor.RelationExtractor.begin_extraction', return_value=Mock())