[cad161]: / tests / helpers.py

Download this file

43 lines (33 with data), 868 Bytes

 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
import spacy
import edsnlp
def make_nlp(lang):
if lang == "eds":
model = spacy.blank("eds")
else:
model = edsnlp.blank("fr")
model.add_pipe("eds.normalizer")
model.add_pipe("eds.sentences")
model.add_pipe("eds.sections")
model.add_pipe(
"eds.matcher",
config=dict(
terms=dict(patient="patient"),
attr="NORM",
ignore_excluded=True,
),
)
model.add_pipe(
"eds.matcher",
name="matcher2",
config=dict(
regex=dict(anomalie=r"anomalie"),
),
)
model.add_pipe("eds.hypothesis")
model.add_pipe("eds.negation")
model.add_pipe("eds.family")
model.add_pipe("eds.history")
model.add_pipe("eds.reported_speech")
model.add_pipe("eds.dates")
model.add_pipe("eds.quantities")
return model