edsnlp.pipelines.ner.scores.base_score
Score
Bases: ContextualMatcher
Matcher component to extract a numeric score
Source code in edsnlp/pipelines/ner/scores/base_score.py
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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
__init__(nlp, score_name, regex, attr, value_extract, score_normalization, window, ignore_excluded, ignore_space_tokens, flags)
PARAMETER | DESCRIPTION |
---|---|
nlp |
The spaCy object.
TYPE:
|
score_name |
The name of the extracted score
TYPE:
|
regex |
A list of regexes to identify the score
TYPE:
|
attr |
Whether to match on the text ('TEXT') or on the normalized text ('NORM')
TYPE:
|
value_extract |
Regex with capturing group to get the score value
TYPE:
|
score_normalization |
Function that takes the "raw" value extracted from the
TYPE:
|
window |
Number of token to include after the score's mention to find the score's value
TYPE:
|
ignore_excluded |
Whether to ignore excluded spans when matching
TYPE:
|
ignore_space_tokens |
Whether to ignore space tokens when matching
TYPE:
|
flags |
Regex flags to use when matching
TYPE:
|
Source code in edsnlp/pipelines/ner/scores/base_score.py
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 |
|
__call__(doc)
Adds spans to document.
PARAMETER | DESCRIPTION |
---|---|
doc |
spaCy Doc object
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
doc
|
spaCy Doc object, annotated for extracted terms.
TYPE:
|
Source code in edsnlp/pipelines/ner/scores/base_score.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
score_filtering(ents)
Extracts, if available, the value of the score.
Normalizes the score via the provided self.score_normalization
method.
PARAMETER | DESCRIPTION |
---|---|
ents |
List of spaCy's spans extracted by the score matcher
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
ents
|
List of spaCy's spans, with, if found, an added
TYPE:
|
Source code in edsnlp/pipelines/ner/scores/base_score.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|