diff --git a/docs/scripts/plugin.py b/docs/scripts/plugin.py index 4e77a6710..af26ec1b0 100644 --- a/docs/scripts/plugin.py +++ b/docs/scripts/plugin.py @@ -1,10 +1,13 @@ import os +import re from pathlib import Path import mkdocs.config +import mkdocs.plugins import mkdocs.structure import mkdocs.structure.files import mkdocs.structure.nav +import mkdocs.structure.pages def exclude_file(name): @@ -118,3 +121,21 @@ def on_page_read_source(page, config): if page.file.src_path in VIRTUAL_FILES: return VIRTUAL_FILES[page.file.src_path] return None + + +@mkdocs.plugins.event_priority(-1000) +def on_page_content( + html: str, + page: mkdocs.structure.pages.Page, + config: mkdocs.config.Config, + files: mkdocs.structure.files.Files, +): + def replace_link(match): + relative_url = url = match.group(1) + page_url = os.path.join("/", page.file.url) + if url.startswith("/"): + relative_url = os.path.relpath(url, page_url) + return f'href="{relative_url}"' + + # Replace absolute paths with path relative to the rendered page + return re.sub(r'href="([^"]*)"', replace_link, html) diff --git a/edsnlp/pipelines/qualifiers/base.py b/edsnlp/pipelines/qualifiers/base.py index 5eb982d3d..376c6bc9b 100644 --- a/edsnlp/pipelines/qualifiers/base.py +++ b/edsnlp/pipelines/qualifiers/base.py @@ -46,8 +46,7 @@ class RuleBasedQualifier(BaseComponent): a string with the value "TEXT" or "NORM", or a dict with the key 'term_attr' we can also add a key for each regex. span_getter : SpanGetterArg - Where to look for dates in the doc. By default, look in the whole doc. You can - combine this with the `merge_mode` argument for interesting results. + Which entities should be classified. By default, `doc.ents` on_ents_only : Union[bool, str, List[str], Set[str]] Whether to look for matches around detected entities only. Useful for faster inference in downstream tasks. diff --git a/edsnlp/pipelines/qualifiers/family/family.py b/edsnlp/pipelines/qualifiers/family/family.py index 47739e5a5..28229141e 100644 --- a/edsnlp/pipelines/qualifiers/family/family.py +++ b/edsnlp/pipelines/qualifiers/family/family.py @@ -79,8 +79,7 @@ class FamilyContextQualifier(RuleBasedQualifier): termination : Optional[List[str]] List of syntagms termination terms. span_getter : SpanGetterArg - Where to look for dates in the doc. By default, look in the whole doc. You can - combine this with the `merge_mode` argument for interesting results. + Which entities should be classified. By default, `doc.ents` on_ents_only : Union[bool, str, List[str], Set[str]] Deprecated, use `span_getter` instead. diff --git a/edsnlp/pipelines/qualifiers/history/history.py b/edsnlp/pipelines/qualifiers/history/history.py index 2d6833c4a..9427ee134 100644 --- a/edsnlp/pipelines/qualifiers/history/history.py +++ b/edsnlp/pipelines/qualifiers/history/history.py @@ -145,8 +145,7 @@ class HistoryQualifier(RuleBasedQualifier): closest_dates_only : bool Whether to include the closest dates only. span_getter : SpanGetterArg - Where to look for dates in the doc. By default, look in the whole doc. You can - combine this with the `merge_mode` argument for interesting results. + Which entities should be classified. By default, `doc.ents` on_ents_only : Union[bool, str, List[str], Set[str]] Deprecated, use `span_getter` instead. diff --git a/edsnlp/pipelines/qualifiers/hypothesis/hypothesis.py b/edsnlp/pipelines/qualifiers/hypothesis/hypothesis.py index 26cb90a6c..17fb3839c 100644 --- a/edsnlp/pipelines/qualifiers/hypothesis/hypothesis.py +++ b/edsnlp/pipelines/qualifiers/hypothesis/hypothesis.py @@ -115,7 +115,8 @@ class HypothesisQualifier(RuleBasedQualifier): attr : str spaCy's attribute to use: a string with the value "TEXT" or "NORM", or a dict with the key 'term_attr' - we can also add a key for each regex. + span_getter : SpanGetterArg + Which entities should be classified. By default, `doc.ents` on_ents_only : Union[bool, str, List[str], Set[str]] Deprecated, use `span_getter` instead. diff --git a/edsnlp/pipelines/qualifiers/negation/negation.py b/edsnlp/pipelines/qualifiers/negation/negation.py index 2ad21790c..a28aa2446 100644 --- a/edsnlp/pipelines/qualifiers/negation/negation.py +++ b/edsnlp/pipelines/qualifiers/negation/negation.py @@ -116,8 +116,7 @@ class NegationQualifier(RuleBasedQualifier): termination : Optional[List[str]] List of termination terms. span_getter : SpanGetterArg - Where to look for dates in the doc. By default, look in the whole doc. You can - combine this with the `merge_mode` argument for interesting results. + Which entities should be classified. By default, `doc.ents` on_ents_only : Union[bool, str, List[str], Set[str]] Deprecated, use `span_getter` instead. diff --git a/edsnlp/pipelines/qualifiers/reported_speech/reported_speech.py b/edsnlp/pipelines/qualifiers/reported_speech/reported_speech.py index 0d6838c81..6b14b9b14 100644 --- a/edsnlp/pipelines/qualifiers/reported_speech/reported_speech.py +++ b/edsnlp/pipelines/qualifiers/reported_speech/reported_speech.py @@ -83,6 +83,8 @@ class ReportedSpeechQualifier(RuleBasedQualifier): a string with the value "TEXT" or "NORM", or a dict with the key 'term_attr' we can also add a key for each regex. + span_getter : SpanGetterArg + Which entities should be classified. By default, `doc.ents` on_ents_only : Union[bool, str, List[str], Set[str]] Whether to look for matches around detected entities only. Useful for faster inference in downstream tasks. diff --git a/mkdocs.yml b/mkdocs.yml index fdac65d4a..952b33115 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -190,7 +190,6 @@ plugins: show_root_toc_entry: false show_signature: false merge_init_into_class: true - - autolinks - bibtex: bibtex_file: "docs/references.bib" # Just uncomment the following lines to enable i18n diff --git a/pyproject.toml b/pyproject.toml index 1c5150953..5147a8c2b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,7 +51,6 @@ dev = [ "mkdocs~=1.5.2", "mkdocstrings~=0.20", "mkdocstrings-python~=1.1", - "mkdocs-autolinks-plugin~=0.7.1", "pybtex~=0.24.0", "pathspec>=0.11.1", # required by vendored mkdocs-autorefs PR "astunparse",