forked from aphp/edsnlp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
116 lines (105 loc) · 3.6 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
from distutils.sysconfig import get_python_inc
import numpy
from Cython.Build import cythonize
from setuptools import Extension, find_packages, setup
def get_lines(relative_path):
with open(relative_path) as f:
return f.readlines()
def get_version(path):
with open(path, "r") as f:
for line in f:
if line.startswith("__version__"):
return line.split('"')[1]
raise RuntimeError("Unable to find version string.")
COMPILER_DIRECTIVES = {
"language_level": "3",
}
MOD_NAMES = [
"edsnlp.matchers.phrase",
"edsnlp.pipelines.core.sentences.sentences",
]
include_dirs = [
numpy.get_include(),
get_python_inc(plat_specific=True),
]
ext_modules = []
for name in MOD_NAMES:
mod_path = name.replace(".", "/") + ".pyx"
ext = Extension(
name,
[mod_path],
language="c++",
include_dirs=include_dirs,
extra_compile_args=["-std=c++11"],
)
ext_modules.append(ext)
print("Cythonizing sources")
ext_modules = cythonize(ext_modules, compiler_directives=COMPILER_DIRECTIVES)
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
factories = [
"matcher = edsnlp.components:matcher",
"terminology = edsnlp.components:terminology",
"contextual_matcher = edsnlp.components:contextual_matcher",
"endlines = edsnlp.components:endlines",
"sentences = edsnlp.components:sentences",
"normalizer = edsnlp.components:normalizer",
"accents = edsnlp.components:accents",
"lowercase = edsnlp.components:remove_lowercase",
"pollution = edsnlp.components:pollution",
"quotes = edsnlp.components:quotes",
"charlson = edsnlp.components:charlson",
"sofa = edsnlp.components:sofa",
"tnm = edsnlp.components:tnm",
"priority = edsnlp.components:priority",
"ccmu = edsnlp.components:ccmu",
'gemsa" = edsnlp.components:gemsa',
'covid" = edsnlp.components:covid',
'cim10" = edsnlp.components:cim10',
"history = edsnlp.components:history",
"family = edsnlp.components:family",
"hypothesis = edsnlp.components:hypothesis",
"negation = edsnlp.components:negation",
"rspeech = edsnlp.components:rspeech",
"consultation_dates = edsnlp.components:consultation_dates",
"dates = edsnlp.components:dates",
"reason = edsnlp.components:reason",
"sections = edsnlp.components:sections",
"context = edsnlp.components:context",
"measurements = edsnlp.components:measurements",
"drugs = edsnlp.components:drugs",
]
setup(
name="edsnlp",
version=get_version("edsnlp/__init__.py"),
author="Data Science - DSI APHP",
author_email="[email protected]",
description=(
"A set of spaCy components to extract information "
"from clinical notes written in French."
),
url="https://github.com/aphp/edsnlp",
project_urls={
"Documentation": "https://aphp.github.io/edsnlp",
"Demo": "https://aphp.github.io/edsnlp/demo",
"Bug Tracker": "https://github.com/aphp/edsnlp/issues",
},
long_description=long_description,
long_description_content_type="text/markdown",
python_requires=">=3.7",
packages=find_packages(),
install_requires=get_lines("requirements.txt"),
ext_modules=ext_modules,
extras_require=dict(
demo=["streamlit>=1.2"],
distributed=["pyspark"],
),
package_data={
"edsnlp": ["resources/*.csv", "resources/*.json", "resources/*.csv.gz"],
"": ["*.pyx", "*.pxd", "*.pxi"],
},
entry_points={
"spacy_factories": factories,
"spacy_languages": ["eds = edsnlp.language:EDSLanguage"],
},
)