Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/concept-linking' into concept-li…
Browse files Browse the repository at this point in the history
…nking
  • Loading branch information
Vi Thien Le authored and Vi Thien Le committed Dec 19, 2023
2 parents 572cfb8 + 4eb2cf1 commit d4f62f5
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
]
},
{
"sentence": "Michelle Obama is an person.",
"sentence": "Michelle Obama is a person.",
"sentenceStartIndex": 0,
"sentenceEndIndex": 24,
"sentenceEndIndex": 26,
"entityMentions": [
{
"name": "Barack Obama",
"name": "Michelle Obama",
"type": "Entity",
"label": "PERSON",
"startIndex": 0,
"endIndex": 11,
"iri": "knox-kb01.srv.aau.dk/Barack_Obama"
"endIndex": 13,
"iri": "knox-kb01.srv.aau.dk/Michelle_Obama"
}
]
}
Expand Down
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: 2 additions & 0 deletions concept_linking/solutions/PromptEngineering/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# Local API url docker
# api_url = "http://llama-cpu-server:5000/llama"



# Remote API url
# api_url = "http://knox-proxy01.srv.aau.dk/llama-api/llama"

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 d4f62f5

Please sign in to comment.