Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refacto of the extensions #213

Merged
merged 22 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4fbf4b4
refacto: hardcode the label/span group name of extracted entities in …
percevalw Aug 4, 2023
9dcf057
refacto: split dates into dates and durations & and add bound attribu…
percevalw Aug 4, 2023
f07c510
feat: fix to_datetime/duration docs & integration with eds.history
percevalw Jun 8, 2022
208433c
fix: close ignore case group in tokenizer regex
percevalw Sep 12, 2023
921b384
docs: vendor autorefs, add dynamic docstrings, templates, fix code re…
percevalw Sep 12, 2023
06df26c
chore: switch from flake8 to ruff
percevalw Sep 12, 2023
f075e2e
docs: vendor autorefs, add dynamic docstrings, templates, fix code re…
percevalw Sep 12, 2023
0fcbf81
test: fetch code blocks in docstrings via markdown extension
percevalw Sep 12, 2023
2de67ed
refacto: unify span_getter & span_setter parameters #203
percevalw Sep 12, 2023
501c463
refacto: add span_getter/setter args to core pipes & move docs in doc…
percevalw Sep 12, 2023
48daf1f
refacto: move tnm out of scores
percevalw Sep 12, 2023
c756b05
refacto: span_getter/setter in ner/misc pipes & update docs
percevalw Sep 12, 2023
bf22bda
refacto: rename upper case components
percevalw Sep 12, 2023
cbc8c65
refacto: update disorder/behavior pipes with new span_getter, span_se…
percevalw Sep 12, 2023
454805c
refacto: add span_getter to qualifier pipes (with backward compat) & …
percevalw Sep 12, 2023
9295bd2
docs: change no-check comments into code fence class & change fr into…
percevalw Sep 12, 2023
97dd271
chore: update entry points
percevalw Sep 12, 2023
ab8c4e8
feat: add all ner pipes to demo
percevalw Sep 12, 2023
be8cd6d
ci: only check changed files with pre-commit
percevalw Sep 12, 2023
c4afbe3
docs: vendor autorefs, add dynamic docstrings, templates, fix code re…
percevalw Sep 12, 2023
9943328
fix: quick examples
percevalw Sep 12, 2023
52a5b91
chore: improve coverage and clean entry points
percevalw Sep 13, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install '.[docs]'
pip install '.[dev]'
- name: Set up Git
run: |
git config user.name ${{ github.actor }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install '.[docs]'
pip install '.[dev]'
- name: Set up Git
run: |
git config user.name ${{ github.actor }}
Expand Down
23 changes: 9 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,17 @@ on:

jobs:
Linting:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Set PY variable
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v2
- uses: actions/checkout@v3
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install pre-commit
run: |
pip install pre-commit
pre-commit install
- name: Run pre-commit
run: SKIP=no-commit-to-branch pre-commit run --all-files
# requites to grab the history of the PR
fetch-depth: 0
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
with:
extra_args: --color=always --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}

Pytest:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -79,7 +74,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install '.[docs]'
pip install '.[dev]'
- name: Build documentation
run: |
mkdocs build --clean
Expand Down
25 changes: 6 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,15 @@ repos:
- id: check-toml
- id: check-json
- id: check-symlinks
- id: check-docstring-first
- id: check-added-large-files
- id: detect-private-key
- repo: https://github.com/pycqa/isort
rev: 5.11.5
# ruff
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.288'
hooks:
- id: isort
name: isort (python)
args: ["--profile", "black"]
- id: isort
name: isort (cython)
types: [cython]
args: ["--profile", "black"]
- id: isort
name: isort (pyi)
types: [pyi]
args: ["--profile", "black"]

- id: ruff
args: ['--config', 'pyproject.toml']
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
Expand All @@ -45,10 +36,6 @@ repos:
- id: blacken-docs
additional_dependencies: [black==20.8b1]
exclude: notebooks/
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/econchick/interrogate
rev: 1.5.0
hooks:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ create-env: .venv

install : .venv
. .venv/bin/activate
pip install -r '.[dev,docs,setup]'.txt
pip install -r '.[dev,setup]'.txt
python scripts/conjugate_verbs.py
pip install -e .
pre-commit install

documentation: .venv
. .venv/bin/activate
pip install -e '.[docs]'
pip install -e '.[dev]'
mkdocs serve

test: .venv
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Once you've installed the library, let's begin with a very simple example that e
```python
import spacy

nlp = spacy.blank("fr")
nlp = spacy.blank("eds")

terms = dict(
covid=["covid", "coronavirus"],
Expand Down
30 changes: 26 additions & 4 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
# Changelog

## Pending
## Unreleased

### Added

- New `to_duration` method to convert an absolute date into a date relative to the note_datetime (or None)

### Changes

- Input and output of components are now specified by `span_getter` and `span_setter` arguments.
- :boom: Score / disorders / behaviors entities now have a fixed label (passed as an argument), instead of being dynamically set from the component name. The following scores may have a different name than the current one in your pipelines:
* `eds.emergency.gemsa` → `emergency_gemsa`
* `eds.emergency.ccmu` → `emergency_ccmu`
* `eds.emergency.priority` → `emergency_priority`
* `eds.charlson` → `charlson`
* `eds.elston_ellis` → `elston_ellis`
* `eds.SOFA` → `sofa`
* `eds.adicap` → `adicap`
* `eds.measuremets` → `size`, `weight`, ... instead of `eds.size`, `eds.weight`, ...
- `eds.dates` now separate dates from durations. Each entity has its own label:
* `spans["dates"]` → entities labelled as `date` with a `span._.date` parsed object
* `spans["durations"]` → entities labelled as `duration` with a `span._.duration` parsed object
- the "relative" / "absolute" / "duration" mode of the time entity is now stored in
the `mode` attribute of the `span._.date/duration`
- the "from" / "until" period bound, if any, is now stored in the `span._.date.bound` attribute
- `to_datetime` now only return absolute dates, converts relative dates into absolute if `doc._.note_datetime` is given, and None otherwise

### Fixed
- `export_to_brat` issue with spans of entities on multiple lines.
Expand Down Expand Up @@ -300,9 +324,7 @@ Fix release to allow installation from source

- Renamed `generic` to `matcher`. This is a non-breaking change for the average user, adding the pipeline is still :

<!-- no-check -->

```python
```{ .python .no-check }
nlp.add_pipe("matcher", config=dict(terms=dict(maladie="maladie")))
```

Expand Down
4 changes: 2 additions & 2 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $ python -m venv venv
$ source venv/bin/activate

# Install the package with common, dev, setup dependencies in editable mode
$ pip install -e '.[dev,docs,setup]'
$ pip install -e '.[dev,setup]'
# And build resources
$ python scripts/conjugate_verbs.py
```
Expand Down Expand Up @@ -113,7 +113,7 @@ We use `MkDocs` for EDS-NLP's documentation. You can checkout the changes you ma

```console
# Install the requirements
$ pip install -e '.[docs]'
$ pip install -e '.[dev]'
---> 100%
color:green Installation successful

Expand Down
Loading
Loading