Skip to content

Commit

Permalink
Changed main concept linking solution to untrained spacy
Browse files Browse the repository at this point in the history
  • Loading branch information
casparemiljensen committed Dec 18, 2023
1 parent 0b12e1d commit 4eb2cf1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions concept_linking/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions concept_linking/solutions/StringComparison/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
3 changes: 2 additions & 1 deletion relation_extraction/relation_extractor.py
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions test/test_server/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down

0 comments on commit 4eb2cf1

Please sign in to comment.