Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Deploy MkDocs to GitHub Pages
on:
push:
branches:
- develop-mkdocs # Trigger this workflow on push to the develop branch
- main
pull_request:
branches:
- develop-mkdocs # Also trigger on pull requests to the develop branch
- main

jobs:
deploy:
Expand Down
8 changes: 4 additions & 4 deletions hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_ontology_annotations(config, ontology_id, text):

response.raise_for_status()
response_data = response.json()
print(f"Response from {ontology_id} ontology: {response_data}")
# print(f"Response from {ontology_id} ontology: {response_data}")

if 'matches' in response_data and isinstance(response_data['matches'], list):
text_with_spans = wrap_terms_in_span(text, response_data['matches'])
Expand All @@ -49,7 +49,7 @@ def get_ontology_annotations(config, ontology_id, text):

def wrap_terms_in_span(text, matches):

cleaner_matches = [{'matched_term': m['matched_term'], 'start': m['start'], 'end': m['end'], 'iri': m['iri']} for m in matches]
cleaner_matches = [{'term': m['token'],'matched_term': m['matched_term'], 'start': m['start'], 'end': m['end'], 'iri': m['iri']} for m in matches]
sorted_matches = sorted(cleaner_matches, key=lambda m: (-len(m['matched_term']), -m['start']))

modified_positions = set()
Expand Down Expand Up @@ -80,8 +80,8 @@ def wrap_terms_in_span(text, matches):

for match in modifications:
result += text[last_end:match['start']]
result += f"<a href={match['iri']} style='border-bottom: 1px dotted #666; text-decoration: none;'>{match['matched_term']}</a> "
last_end = match['end'] + 1
result += f"<a href={match['iri']} style='border-bottom: 1px dotted #666; text-decoration: none;'>{match['term']}</a>"
last_end = match['end']

result += text[last_end:]

Expand Down