DEMNE 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. demne-1.3.0/.gitattributes +1 -0
  2. demne-1.3.0/.github/workflows/ci.yml +141 -0
  3. demne-1.3.0/.github/workflows/gpu.yml +163 -0
  4. demne-1.3.0/.gitignore +76 -0
  5. demne-1.3.0/.pre-commit-config.yaml +16 -0
  6. demne-1.3.0/CHANGELOG.md +74 -0
  7. demne-1.3.0/CITATION.cff +13 -0
  8. demne-1.3.0/CONTRIBUTING.md +25 -0
  9. demne-1.3.0/LICENSE +18 -0
  10. demne-1.3.0/MANIFEST.in +18 -0
  11. demne-1.3.0/Makefile +22 -0
  12. demne-1.3.0/PKG-INFO +201 -0
  13. demne-1.3.0/README.md +125 -0
  14. demne-1.3.0/Results/demne_params_published.json +57 -0
  15. demne-1.3.0/dashboard/.streamlit/config.toml +18 -0
  16. demne-1.3.0/dashboard/README.md +57 -0
  17. demne-1.3.0/dashboard/app.py +61 -0
  18. demne-1.3.0/dashboard/config/default_thresholds.yaml +4 -0
  19. demne-1.3.0/dashboard/config/entities.json +88 -0
  20. demne-1.3.0/dashboard/core/__init__.py +18 -0
  21. demne-1.3.0/dashboard/core/brat_parser.py +136 -0
  22. demne-1.3.0/dashboard/core/metrics.py +313 -0
  23. demne-1.3.0/dashboard/core/routing.py +48 -0
  24. demne-1.3.0/dashboard/gui_app.py +894 -0
  25. demne-1.3.0/dashboard/notebook_view.py +369 -0
  26. demne-1.3.0/dashboard/notebook_webview.py +188 -0
  27. demne-1.3.0/dashboard/pages/1_Dashboard_Metriques.py +234 -0
  28. demne-1.3.0/dashboard/pages/2_Analyse_Corpus.py +120 -0
  29. demne-1.3.0/dashboard/pages/3_REST_Integration.py +93 -0
  30. demne-1.3.0/dashboard/pages/4_Notebook_REST.py +133 -0
  31. demne-1.3.0/data/ALL_CORPORA/.gitkeep +0 -0
  32. demne-1.3.0/data/OFF_DOMAIN_CORPORA/.gitkeep +0 -0
  33. demne-1.3.0/data/OPT_CORPORA/.gitkeep +0 -0
  34. demne-1.3.0/data/README.md +17 -0
  35. demne-1.3.0/data/TEST_CORPORA/.gitkeep +0 -0
  36. demne-1.3.0/docs/DATA_GOVERNANCE.md +11 -0
  37. demne-1.3.0/docs/OPTIMIZE_PARAMS.md +128 -0
  38. demne-1.3.0/docs/RAPPORT_COMPREHENSION.md +1105 -0
  39. demne-1.3.0/main.py +642 -0
  40. demne-1.3.0/pyproject.toml +176 -0
  41. demne-1.3.0/scripts/generate_manifest.py +465 -0
  42. demne-1.3.0/scripts/install-hooks.sh +11 -0
  43. demne-1.3.0/scripts/pre-commit-hook.sh +34 -0
  44. demne-1.3.0/setup.cfg +4 -0
  45. demne-1.3.0/src/DEMNE.egg-info/PKG-INFO +201 -0
  46. demne-1.3.0/src/DEMNE.egg-info/SOURCES.txt +112 -0
  47. demne-1.3.0/src/DEMNE.egg-info/dependency_links.txt +1 -0
  48. demne-1.3.0/src/DEMNE.egg-info/entry_points.txt +2 -0
  49. demne-1.3.0/src/DEMNE.egg-info/requires.txt +62 -0
  50. demne-1.3.0/src/DEMNE.egg-info/top_level.txt +1 -0
  51. demne-1.3.0/src/demne/REST_interface/README.md +49 -0
  52. demne-1.3.0/src/demne/REST_interface/REST.ipynb +153 -0
  53. demne-1.3.0/src/demne/REST_interface/REST_modules/__init__.py +5 -0
  54. demne-1.3.0/src/demne/REST_interface/REST_modules/calculs/__init__.py +8 -0
  55. demne-1.3.0/src/demne/REST_interface/REST_modules/calculs/bootstrap.py +140 -0
  56. demne-1.3.0/src/demne/REST_interface/REST_modules/calculs/concordancer.py +138 -0
  57. demne-1.3.0/src/demne/REST_interface/REST_modules/calculs/metrics.py +492 -0
  58. demne-1.3.0/src/demne/REST_interface/REST_modules/calculs/ngram.py +103 -0
  59. demne-1.3.0/src/demne/REST_interface/REST_modules/calculs/recommendations.py +204 -0
  60. demne-1.3.0/src/demne/REST_interface/REST_modules/calculs/regex.py +158 -0
  61. demne-1.3.0/src/demne/REST_interface/REST_modules/calculs/results.py +136 -0
  62. demne-1.3.0/src/demne/REST_interface/REST_modules/calculs/tfidf.py +163 -0
  63. demne-1.3.0/src/demne/REST_interface/REST_modules/categorization.py +94 -0
  64. demne-1.3.0/src/demne/REST_interface/REST_modules/extraction/__init__.py +3 -0
  65. demne-1.3.0/src/demne/REST_interface/REST_modules/extraction/brat.py +302 -0
  66. demne-1.3.0/src/demne/REST_interface/REST_modules/extraction/normalisation.py +312 -0
  67. demne-1.3.0/src/demne/REST_interface/REST_modules/extraction/saving.py +84 -0
  68. demne-1.3.0/src/demne/REST_interface/REST_modules/initialization.py +177 -0
  69. demne-1.3.0/src/demne/REST_interface/REST_modules/loading.py +67 -0
  70. demne-1.3.0/src/demne/REST_interface/REST_modules/ui.py +1064 -0
  71. demne-1.3.0/src/demne/REST_interface/REST_modules/visualization.py +177 -0
  72. demne-1.3.0/src/demne/REST_interface/__init__.py +13 -0
  73. demne-1.3.0/src/demne/REST_interface/convergence_analyzer.py +68 -0
  74. demne-1.3.0/src/demne/REST_interface/demo_rest.py +98 -0
  75. demne-1.3.0/src/demne/REST_interface/logo.png +0 -0
  76. demne-1.3.0/src/demne/REST_interface/rest_annotator.py +157 -0
  77. demne-1.3.0/src/demne/REST_interface/rest_decision_bridge.py +88 -0
  78. demne-1.3.0/src/demne/REST_interface/rest_evaluator.py +100 -0
  79. demne-1.3.0/src/demne/REST_interface/rest_pipeline.py +35 -0
  80. demne-1.3.0/src/demne/REST_interface/templates/annotation_template.html +30 -0
  81. demne-1.3.0/src/demne/REST_interface/templates/evaluation_form.html +19 -0
  82. demne-1.3.0/src/demne/REST_interface/templates/results_dashboard.html +14 -0
  83. demne-1.3.0/src/demne/__init__.py +29 -0
  84. demne-1.3.0/src/demne/_brat.py +154 -0
  85. demne-1.3.0/src/demne/_table.py +28 -0
  86. demne-1.3.0/src/demne/_tracking.py +59 -0
  87. demne-1.3.0/src/demne/cli.py +27 -0
  88. demne-1.3.0/src/demne/data/demne_params.json +57 -0
  89. demne-1.3.0/src/demne/decision_tree_builder.py +351 -0
  90. demne-1.3.0/src/demne/frequency.py +200 -0
  91. demne-1.3.0/src/demne/homogeneity.py +241 -0
  92. demne-1.3.0/src/demne/ner_feasibility.py +109 -0
  93. demne-1.3.0/src/demne/optimize_params.py +1130 -0
  94. demne-1.3.0/src/demne/params.py +177 -0
  95. demne-1.3.0/src/demne/py.typed +0 -0
  96. demne-1.3.0/src/demne/risk_context.py +394 -0
  97. demne-1.3.0/src/demne/routing.py +113 -0
  98. demne-1.3.0/src/demne/templatability.py +270 -0
  99. demne-1.3.0/src/demne/tfidf_coverage.py +186 -0
  100. demne-1.3.0/src/demne/visualize_decision_tree.py +110 -0
  101. demne-1.3.0/tests/conftest.py +155 -0
  102. demne-1.3.0/tests/test_brat.py +206 -0
  103. demne-1.3.0/tests/test_decision_tree.py +135 -0
  104. demne-1.3.0/tests/test_feasibility.py +33 -0
  105. demne-1.3.0/tests/test_frequency.py +87 -0
  106. demne-1.3.0/tests/test_gpu.py +309 -0
  107. demne-1.3.0/tests/test_homogeneity.py +57 -0
  108. demne-1.3.0/tests/test_params.py +67 -0
  109. demne-1.3.0/tests/test_pipeline_integration.py +414 -0
  110. demne-1.3.0/tests/test_risk_context.py +61 -0
  111. demne-1.3.0/tests/test_routing_equivalence.py +127 -0
  112. demne-1.3.0/tests/test_templatability.py +47 -0
  113. demne-1.3.0/tests/test_tfidf_extractability.py +189 -0
  114. demne-1.3.0/tests/test_tracking.py +88 -0
@@ -0,0 +1 @@
1
+ *.py text working-tree-encoding=UTF-8 eol=lf
@@ -0,0 +1,141 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ # Triggered on development branches AND on vX.Y.Z tags
6
+ # (tags act as the trigger for the publish job)
7
+ branches: [main, develop]
8
+ tags: ["v*.*.*"]
9
+ pull_request:
10
+ branches: [main]
11
+
12
+ jobs:
13
+ lint-and-test:
14
+ runs-on: ${{ matrix.os }}
15
+ strategy:
16
+ matrix:
17
+ os: [ubuntu-latest, windows-latest, macos-latest]
18
+ python-version: ["3.10", "3.11", "3.12"]
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+
23
+ - name: Set up Python ${{ matrix.python-version }}
24
+ uses: actions/setup-python@v5
25
+ with:
26
+ python-version: ${{ matrix.python-version }}
27
+
28
+ # -----------------------------------------------------------------------
29
+ # Cache pip: GitHub caches ~/.cache/pip between runs.
30
+ # Key includes OS, Python version, and a hash of pyproject.toml.
31
+ # If pyproject.toml hasn't changed, the cache is reused → ~30-60 s
32
+ # of installation saved per runner.
33
+ # -----------------------------------------------------------------------
34
+ - name: Cache pip
35
+ uses: actions/cache@v4
36
+ with:
37
+ path: ~/.cache/pip
38
+ key: pip-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
39
+ restore-keys: |
40
+ pip-${{ runner.os }}-${{ matrix.python-version }}-
41
+
42
+ - name: Install dependencies
43
+ run: |
44
+ pip install -e ".[dev,ner]"
45
+
46
+ - name: Cache pre-commit environments
47
+ uses: actions/cache@v4
48
+ with:
49
+ path: ~/.cache/pre-commit
50
+ key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
51
+
52
+ - name: Lint and format check (ruff + black via pre-commit)
53
+ run: pre-commit run --all-files
54
+
55
+ # -----------------------------------------------------------------------
56
+ # Type-check with mypy.
57
+ # Installed separately (not in the dev group) to keep the prod env light.
58
+ # --ignore-missing-imports suppresses errors for libs without stubs
59
+ # (eco2ai, seqeval…).
60
+ # -----------------------------------------------------------------------
61
+ - name: Type-check with mypy
62
+ run: |
63
+ pip install mypy
64
+ mypy src/demne --ignore-missing-imports --no-error-summary
65
+
66
+ # -----------------------------------------------------------------------
67
+ # CPU-only tests: GPU tests are explicitly excluded
68
+ # (-m "not cuda and not rocm") so the job never tries to load a model
69
+ # on a non-existent GPU (which would raise a CUDA error instead of a
70
+ # clean skip).
71
+ # Coverage gate: --cov-fail-under=75 fails the job if overall coverage
72
+ # drops below 75 %.
73
+ # -----------------------------------------------------------------------
74
+ - name: Run unit and integration tests (CPU only)
75
+ run: >
76
+ pytest
77
+ -m "not cuda and not rocm"
78
+ --cov=demne
79
+ --cov-report=xml
80
+ --cov-fail-under=75
81
+ --tb=short
82
+ -q
83
+
84
+ - name: Upload coverage to Codecov
85
+ uses: codecov/codecov-action@v4
86
+ with:
87
+ file: ./coverage.xml
88
+ flags: unittests
89
+
90
+ # ---------------------------------------------------------------------------
91
+ # Publish job: runs ONLY on a vX.Y.Z tag pushed to main.
92
+ # Depends on lint-and-test (needs:) → the package is published only if all
93
+ # tests pass across the 9 OS×Python combinations.
94
+ # Required secrets in the repo's GitHub Settings:
95
+ # PYPI_API_TOKEN → token generated on pypi.org (scope: DEMNE project)
96
+ # ---------------------------------------------------------------------------
97
+ publish:
98
+ name: Publish to PyPI
99
+ needs: lint-and-test
100
+ runs-on: ubuntu-latest
101
+ # Condition: this job runs only when the event is a vX.Y.Z tag push
102
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
103
+
104
+ permissions:
105
+ # Required for OIDC attestation (optional but recommended by PyPI)
106
+ id-token: write
107
+ contents: read
108
+
109
+ steps:
110
+ - uses: actions/checkout@v4
111
+
112
+ - name: Set up Python
113
+ uses: actions/setup-python@v5
114
+ with:
115
+ python-version: "3.12"
116
+
117
+ - name: Cache pip (publish job)
118
+ uses: actions/cache@v4
119
+ with:
120
+ path: ~/.cache/pip
121
+ key: pip-ubuntu-3.12-${{ hashFiles('pyproject.toml') }}
122
+
123
+ # build generates dist/*.whl and dist/*.tar.gz
124
+ - name: Install build tools
125
+ run: pip install build
126
+
127
+ - name: Build package
128
+ run: python -m build
129
+
130
+ # twine checks package consistency before upload
131
+ - name: Check package with twine
132
+ run: |
133
+ pip install twine
134
+ twine check dist/*
135
+
136
+ # Upload to PyPI using the token stored in repo secrets
137
+ - name: Publish to PyPI
138
+ env:
139
+ TWINE_USERNAME: __token__
140
+ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
141
+ run: twine upload dist/*
@@ -0,0 +1,163 @@
1
+ name: GPU Tests
2
+
3
+ # This workflow is triggered manually (workflow_dispatch) or on push/PR to main.
4
+ # It runs ONLY on self-hosted runners labelled [self-hosted, gpu] — GitHub Actions
5
+ # will leave this job pending (not fail) if no matching runner is registered,
6
+ # which is the intended behaviour while waiting for a runner.
7
+ #
8
+ # How to register a GPU runner:
9
+ # 1. GitHub repo → Settings → Actions → Runners → New self-hosted runner
10
+ # 2. Follow the installation instructions (Linux recommended for CUDA/ROCm)
11
+ # 3. Add the labels "gpu" and "cuda" or "rocm" during configuration
12
+ # 4. Make sure CUDA Toolkit (≥11.8) or ROCm (≥5.4) is installed on the machine
13
+
14
+ on:
15
+ # Only manual dispatch: no push trigger, so no job is ever queued automatically.
16
+ # GPU runners are not registered — automatic triggers would leave jobs pending
17
+ # indefinitely. Trigger manually from Actions → Run workflow when a runner is
18
+ # available.
19
+ workflow_dispatch:
20
+ inputs:
21
+ gpu_type:
22
+ description: "GPU type to target"
23
+ required: false
24
+ default: "any"
25
+ type: choice
26
+ options: [any, cuda, rocm]
27
+
28
+ jobs:
29
+ # ---------------------------------------------------------------------------
30
+ # CUDA job — self-hosted runner with NVIDIA GPU
31
+ # labels: [self-hosted, gpu, cuda]
32
+ # ---------------------------------------------------------------------------
33
+ test-cuda:
34
+ name: "Tests CUDA (NVIDIA self-hosted)"
35
+ # runs-on accepts a list of labels: the runner must have ALL of them
36
+ runs-on: [self-hosted, gpu, cuda]
37
+ # If no runner matches, the job waits — timeout added to avoid
38
+ # blocking a PR indefinitely.
39
+ timeout-minutes: 30
40
+
41
+ steps:
42
+ - uses: actions/checkout@v4
43
+
44
+ - name: Set up Python 3.12
45
+ uses: actions/setup-python@v5
46
+ with:
47
+ python-version: "3.12"
48
+
49
+ # The self-hosted runner may already have a warm pip cache.
50
+ # Sharing it anyway benefits successive runs.
51
+ - name: Cache pip (CUDA runner)
52
+ uses: actions/cache@v4
53
+ with:
54
+ path: ~/.cache/pip
55
+ key: pip-cuda-3.12-${{ hashFiles('pyproject.toml') }}
56
+ restore-keys: pip-cuda-3.12-
57
+
58
+ # Install [gpu] + [dev] + [ner] extras.
59
+ # [gpu] installs torch with the right CUDA index via the
60
+ # PIP_EXTRA_INDEX_URL env var set on the self-hosted runner
61
+ # (e.g. https://download.pytorch.org/whl/cu121).
62
+ # If the variable is not set, pip falls back to PyPI (CPU wheel).
63
+ - name: Install dependencies (CUDA)
64
+ run: pip install -e ".[dev,ner,gpu]"
65
+
66
+ # Quick check that torch sees the GPU before running the tests
67
+ - name: Smoke check — torch sees CUDA
68
+ run: |
69
+ python -c "
70
+ import torch
71
+ assert torch.cuda.is_available(), 'CUDA not available on this runner'
72
+ print(f'GPU: {torch.cuda.get_device_name(0)}, CUDA {torch.version.cuda}')
73
+ "
74
+
75
+ # -m "cuda": runs only tests marked @pytest.mark.cuda
76
+ # --no-header: more compact output for CI logs
77
+ - name: Run CUDA tests
78
+ run: >
79
+ pytest tests/test_gpu.py
80
+ -m "cuda"
81
+ -v
82
+ --tb=short
83
+ --no-header
84
+
85
+ # Unit and integration tests also run on the GPU runner to detect
86
+ # CPU-side regressions in the same environment.
87
+ - name: Run unit + integration tests (on GPU runner)
88
+ run: >
89
+ pytest
90
+ -m "not rocm"
91
+ --cov=demne
92
+ --cov-report=xml
93
+ --cov-fail-under=70
94
+ --tb=short
95
+ -q
96
+
97
+ - name: Upload coverage (CUDA)
98
+ uses: codecov/codecov-action@v4
99
+ with:
100
+ file: ./coverage.xml
101
+ flags: cuda
102
+
103
+ # ---------------------------------------------------------------------------
104
+ # ROCm job — self-hosted runner with AMD GPU
105
+ # labels: [self-hosted, gpu, rocm]
106
+ # ---------------------------------------------------------------------------
107
+ test-rocm:
108
+ name: "Tests ROCm (AMD self-hosted)"
109
+ runs-on: [self-hosted, gpu, rocm]
110
+ timeout-minutes: 30
111
+
112
+ steps:
113
+ - uses: actions/checkout@v4
114
+
115
+ - name: Set up Python 3.12
116
+ uses: actions/setup-python@v5
117
+ with:
118
+ python-version: "3.12"
119
+
120
+ - name: Cache pip (ROCm runner)
121
+ uses: actions/cache@v4
122
+ with:
123
+ path: ~/.cache/pip
124
+ key: pip-rocm-3.12-${{ hashFiles('pyproject.toml') }}
125
+ restore-keys: pip-rocm-3.12-
126
+
127
+ # For ROCm, the self-hosted runner must have PIP_EXTRA_INDEX_URL pointing
128
+ # to https://download.pytorch.org/whl/rocm5.7 (or the installed version).
129
+ - name: Install dependencies (ROCm)
130
+ run: pip install -e ".[dev,ner,gpu]"
131
+
132
+ - name: Smoke check — torch sees ROCm
133
+ run: |
134
+ python -c "
135
+ import torch
136
+ assert torch.cuda.is_available(), 'ROCm/CUDA API not available'
137
+ assert torch.version.hip is not None, 'This torch build is not ROCm'
138
+ print(f'GPU: {torch.cuda.get_device_name(0)}, ROCm {torch.version.hip}')
139
+ "
140
+
141
+ - name: Run ROCm tests
142
+ run: >
143
+ pytest tests/test_gpu.py
144
+ -m "rocm"
145
+ -v
146
+ --tb=short
147
+ --no-header
148
+
149
+ - name: Run unit + integration tests (on ROCm runner)
150
+ run: >
151
+ pytest
152
+ -m "not cuda"
153
+ --cov=demne
154
+ --cov-report=xml
155
+ --cov-fail-under=70
156
+ --tb=short
157
+ -q
158
+
159
+ - name: Upload coverage (ROCm)
160
+ uses: codecov/codecov-action@v4
161
+ with:
162
+ file: ./coverage.xml
163
+ flags: rocm
demne-1.3.0/.gitignore ADDED
@@ -0,0 +1,76 @@
1
+ # === Python ===
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.so
5
+ *.egg-info/
6
+ *.egg
7
+ dist/
8
+ build/
9
+
10
+ # === Environnements ===
11
+ .venv/
12
+ venv/
13
+ env/
14
+ .env
15
+
16
+ # === IDE / Éditeurs ===
17
+ .vscode/
18
+ .idea/
19
+ .claude/
20
+ *.swp
21
+ *.swo
22
+ *~
23
+
24
+ # === Jupyter ===
25
+ .ipynb_checkpoints/
26
+
27
+ # === OS ===
28
+ .DS_Store
29
+ Thumbs.db
30
+ desktop.ini
31
+
32
+ # === Données et modèles ===
33
+ *.pdf
34
+ *.pptx
35
+ *.rar
36
+ *.zip
37
+ *.tar.gz
38
+ data/*
39
+ !data/README.md
40
+ # Recalibration layout (python main.py optimize_params): folders versioned, corpora not
41
+ !data/*_CORPORA/
42
+ data/*_CORPORA/*
43
+ !data/*_CORPORA/.gitkeep
44
+ models/
45
+ NER/models/
46
+
47
+ # === Résultats générés ===
48
+ Results/*
49
+ !Results/demne_params_published.json
50
+ !Results/figures/
51
+ Results/figures/*
52
+ !Results/figures/front_pareto_exemple.png
53
+ !Results/figures/Graph_decision.png
54
+ src/demne/Rules/Results/
55
+ src/demne/Rules/src/Results/
56
+ NER/sweep_results*.csv
57
+
58
+ # === Artefacts runtime ===
59
+ *.log
60
+ *.tmp
61
+ out_errs.json
62
+ jupyter_server_config.json
63
+ energy_consumption_DEMNE.csv
64
+ decision_config.json
65
+ output_decision.txt
66
+ modifications.ps1
67
+ src/demne/REST_interface/Results/
68
+
69
+ # === Tests / Coverage ===
70
+ .pytest_cache/
71
+ htmlcov/
72
+ .coverage
73
+ coverage.xml
74
+
75
+ # === Annotations BRAT : jamais diffusées (local-only, Zenodo/PyPI) ===
76
+ *.ann
@@ -0,0 +1,16 @@
1
+ repos:
2
+ - repo: local
3
+ hooks:
4
+ - id: autofix
5
+ name: black + ruff (format, fix, auto-stage)
6
+ language: system
7
+ entry: bash -c 'black --line-length=100 . && ruff check --fix . && git add -u'
8
+ pass_filenames: false
9
+ always_run: true
10
+
11
+ - id: pytest-fast
12
+ name: pytest (CPU-only, no GPU)
13
+ language: system
14
+ entry: python -m pytest -m "not cuda and not rocm" --tb=short -q --no-header
15
+ pass_filenames: false
16
+ always_run: true
@@ -0,0 +1,74 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
4
+
5
+ ## [1.3.0] - 2026-10-21
6
+ ### Added
7
+
8
+ - `demne` console command (source checkout only: delegates to `main.py`) and `py.typed` marker
9
+
10
+ ### Changed
11
+
12
+ - Core dependencies reduced to numpy, pandas, scikit-learn, scipy, Unidecode; matplotlib, plotly and seaborn moved to the `[viz]` and `[rest]` extras
13
+ - numpy 2.x allowed (removed the `<2.0` cap); development status Beta; author contact email
14
+
15
+ ### Added (since 0.4.0)
16
+
17
+ - `python main.py optimize_params --in_domain | --all_corpora`: Optuna recalibration of `demne_params.json` on user corpora (`data/*_CORPORA/`, extra `[optimize]`), see `docs/OPTIMIZE_PARAMS.md`
18
+ - Presets `CALIBRATED` / `FRUGAL` / `QUALITY` derived from the calibrated thresholds (`preset_margin`) instead of stored absolute values
19
+ - Extra `[energy]` for eco2ai
20
+ - Tests for the `main.py` sub-commands, the dashboard metrics/parser and the scorers' output files; coverage 70 % → 83 %, floor 75 %
21
+ - mypy `disallow_untyped_defs` on the package (all functions annotated) and public docstrings
22
+
23
+ ### Changed
24
+
25
+ - Removed commands `tree`, `export-csv`, `rest` and `rest-config --import`
26
+ - `eco2ai` is now an optional dependency (`demne._tracking` is a no-op without it)
27
+ - One BRAT parser (`demne._brat`) for the scorers, frequency, TF-IDF coverage, optimizer and the dashboard parser
28
+ - One copy of the risk lexicons (`demne.params`) for the CLI scorer, the dashboard and the optimizer
29
+ - Dashboard R now includes the contradiction term, as the CLI scorer does (it was fixed to 0)
30
+ - Dashboard entity preselection comes from `data/decision_config.json` instead of a hardcoded list
31
+ - `main.py info` reads `demne.__version__`
32
+
33
+ ### Fixed
34
+
35
+ - Annotation files (`*.ann`) could ship in the wheel/sdist: removed from `package-data`, excluded in `MANIFEST.in`
36
+
37
+ ## [0.4.0] - 2026-05-29
38
+ ### Changed
39
+
40
+ - Full HDR audit: removed 49 files (artefacts, duplicates, PDFs, caches)
41
+ - Encoding fix UTF-16 → UTF-8 on 5 files (ci.yml, Makefile, CONTRIBUTING.md, DATA_GOVERNANCE.md, reproducibility.yaml)
42
+ - Removed UTF-8 BOM from 4 files
43
+ - Fixed broken Python imports (3 tests + sensitivity_analysis + REST __init__)
44
+ - Replaced 6 absolute Windows paths with DEMNE_ESMO_DIR environment variable
45
+ - Rewrote .gitignore (90 duplicated lines → 35 clean lines)
46
+ - Rewrote Makefile (UTF-16 + broken target → UTF-8 + valid targets)
47
+
48
+ ### Added
49
+
50
+ - pyproject.toml: 14 missing dependencies in 6 optional groups (rest, viz, notebook, reports, gui, ner[pycrysuite])
51
+ - config/example_env.sh: environment variable template
52
+ - Graph_decision.png in Results/figures/ (fixes README image)
53
+
54
+ ### Fixed
55
+
56
+ - Broken README image (Graph_decision_biss.png → Graph_decision.png)
57
+ - Renamed lunch.py → launch.py (typo)
58
+ - README/CITATION.cff URLs
59
+
60
+ ## [0.3.0] - 2026-04-19
61
+ ### Changed
62
+
63
+ - Purged 182 ghost files from the Git index
64
+ - pyproject.toml: fixed build-backend (setuptools.build_meta)
65
+ - Removed requirements.txt (pyproject.toml is now the single source)
66
+ - README: CI/License/Python badges, corrected references
67
+
68
+ ### Added
69
+
70
+ - CITATION.cff, CHANGELOG.md, data/README.md
71
+
72
+ ### Fixed
73
+
74
+ - Regression from commit c0d5795 (4 files re-added)
@@ -0,0 +1,13 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite it as below."
3
+ title: "DEMNE: Adaptive Selection of Named-Entity Extraction Method for Frugal Clinical NLP in Oncology"
4
+ version: 1.3.0
5
+ date-released: 2026-10-21
6
+ authors:
7
+ - family-names: Longeac
8
+ given-names: Clément
9
+ affiliation: ESIEE Paris
10
+ email: clement.longeac@gmail.com
11
+ repository-code: "https://github.com/longeacc/DEMNE-Determination-of-Extraction-Methode-for-Named-Entity"
12
+ license: MIT
13
+ keywords: [NLP, NER, oncology, frugal-AI, biomarkers]
@@ -0,0 +1,25 @@
1
+ # Contributing to DEMNE
2
+
3
+ We welcome contributions to DEMNE!
4
+
5
+ ## Getting Started
6
+
7
+ 1. Fork the repository and create your branch from main.
8
+ 2. Install the development dependencies:
9
+ ```bash
10
+ pip install -e .[dev,ner]
11
+ ```
12
+ 3. Create a branch for your feature or bugfix.
13
+ 4. Ensure you write tests for any new code. Run tests with:
14
+ ```bash
15
+ pytest --cov
16
+ ```
17
+ 5. Follow code style guidelines: We use black, isort, and
18
+ ruff for formatting and linting.
19
+
20
+ ## Pull Requests
21
+ - Format your commit messages using Conventional Commits (e.g., feat: ..., fix: ..., docs: ...).
22
+ - Reference issues you are resolving (e.g. Resolves #123).
23
+
24
+ ## Data Governance
25
+ If you're contributing validation code, ensure it uses synthetic or fully anonymized datatypes matching docs/DATA_GOVERNANCE.md.
demne-1.3.0/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2026 Clément LONGEAC — ESIEE Paris, Université Gustave Eiffel
4
+ Copyright (c) 2024-2026 Akram REDJDAL — Laboratoire de Biomécanique Appliquée (LBA), Aix-Marseille Université
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -0,0 +1,18 @@
1
+ include LICENSE README.md CHANGELOG.md CONTRIBUTING.md CITATION.cff Makefile
2
+ include main.py pyproject.toml
3
+
4
+ recursive-include dashboard *
5
+ recursive-include .github *
6
+ include .gitattributes .gitignore .pre-commit-config.yaml
7
+ include Results/demne_params_published.json
8
+ recursive-include data *
9
+ recursive-include docs *
10
+ recursive-include scripts *
11
+ recursive-include src/demne *
12
+ recursive-include tests *
13
+
14
+ # Clinical annotation data must never ship in an sdist (PyPI / Zenodo).
15
+ global-exclude *.ann
16
+ global-exclude __pycache__
17
+ global-exclude *.py[cod]
18
+ global-exclude *.egg-info
demne-1.3.0/Makefile ADDED
@@ -0,0 +1,22 @@
1
+ .PHONY: install test lint evaluate dashboard clean
2
+
3
+ install:
4
+ pip install -e .[dev,ner]
5
+
6
+ test:
7
+ pytest --cov=demne --tb=short -q
8
+
9
+ lint:
10
+ ruff check .
11
+ black --check .
12
+
13
+ evaluate:
14
+ python main.py evaluate --no-visualize
15
+
16
+ dashboard:
17
+ streamlit run dashboard/app.py
18
+
19
+ clean:
20
+ find . -type d -name __pycache__ -exec rm -rf {} +
21
+ find . -name '*.pyc' -delete
22
+ rm -rf .pytest_cache htmlcov .coverage coverage.xml