term_normalizer
TermNormalizer
Normalizes clinical term strings for high-precision matching.
Source code in src/ariadne/verbatim_mapping/term_normalizer.py
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 | |
normalize_term(term)
Normalizes a clinical term string for high-precision matching.
The pipeline is:
- Convert to lowercase.
- Remove possessive "'s" at the end of words.
- Remove specific non-informative substrings (e.g., '(disorder)'). The strings are taken from the substrings_to_remove list in the config yaml file
- Remove all punctuation.
- Tokenize and lemmatize (e.g., "disorders" -> "disorder").
- Join tokens into a single string, preserving order.
This makes "liver disorders" and "Liver-Disorders (disorder)" both normalize to "liver disorder".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
term
|
str
|
The clinical term string to normalize. |
required |
Returns: The normalized term string.
Source code in src/ariadne/verbatim_mapping/term_normalizer.py
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 | |