Skip to content

Commit

Permalink
Merge pull request #126 from vmenger/optimizations
Browse files Browse the repository at this point in the history
Optimizations and tweaks
  • Loading branch information
vmenger authored Nov 28, 2023
2 parents 29d6b0b + b7cb6a0 commit e43b062
Show file tree
Hide file tree
Showing 20 changed files with 421 additions and 25 deletions.
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,30 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 2.5.0 (2023-11-28)

### Added
- the `RegexpPseudoAnnotator` component for filtering regexp matches based on preceding/following words
- a `prefix_with_interfix` pattern for names, detecting e.g. `Dr. van Loon`

### Fixed
- a bug with `BsnAnnotator` with non-digit characters in regexp

### Changed
- the age detection component, with improved logic and pseudo patterns
- annotations are no longer counted adjacent when separated by a comma
- streets are prioritized over names when merging overlapping annotations
- removed some false positives for postal codes ending in `gr` or `ie`
- extended the postbus pattern for `xx.xxx` format (old notation)
- some smaller optimizations and exceptions for institution, hospital, placename, residence, medical term, first name, and last name lookup lists

## 2.4.2 (2023-11-22)

### Changed
- multi-token lookup for first- and last names, so multi token names are now detected
- some small lookup list additions

## 2.4.3 (2023-11-22)
## 2.4.3 (2023-11-22)

### Changed
- extended list of medical terms
Expand Down
47 changes: 36 additions & 11 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"adjacent_annotations_slack": "[\\. \\-,]?[\\. ]?",
"adjacent_annotations_slack": "[\\. \\-]?[\\. ]?",
"resolve_overlap_strategy": {
"attributes": [
"priority",
Expand Down Expand Up @@ -36,6 +36,25 @@
]
}
},
"prefix_with_interfix": {
"annotator_type": "token_pattern",
"group": "names",
"args": {
"tag": "prefix+interfix+naam",
"skip": ["."],
"pattern": [
{
"lookup": "prefixes"
},
{
"lookup": "interfixes"
},
{
"like_name": true
}
]
}
},
"prefix_with_name": {
"annotator_type": "token_pattern",
"group": "names",
Expand Down Expand Up @@ -314,20 +333,22 @@
"annotator_type": "token_pattern",
"group": "locations",
"args": {
"tag": "straat",
"pattern": [
{
"re_match": "[A-Z][a-z]+(baan|bolwerk|dam|dijk|dreef|drf|dyk|gr|gracht|hf|hof|kade|laan|ln|markt|mrkt|pad|park|pd|plantsoen|plein|pln|plnts|prk|singel|sngl|st|steeg|stg|str|straat|weg|wg)$"
}
]
],
"tag": "straat",
"priority": 1
}
},
"street_lookup": {
"annotator_type": "multi_token",
"group": "locations",
"args": {
"lookup_values": "streets",
"tag": "straat"
"tag": "straat",
"priority": 1
}
},
"housenumber": {
Expand Down Expand Up @@ -385,16 +406,16 @@
"annotator_type": "regexp",
"group": "locations",
"args": {
"regexp_pattern": "(\\d{4}([A-Za-z]{2}| [A-Z]{2}))(?<!mg|MG)(\\W|$)",
"tag": "locatie",
"capturing_group": 1
"regexp_pattern": "(\\d{4}([A-Za-z]{2}| [A-Z]{2}))(?<!mg|MG|gr|ie)(\\W|$)",
"capturing_group": 1,
"tag": "locatie"
}
},
"postbus": {
"annotator_type": "regexp",
"group": "locations",
"args": {
"regexp_pattern": "([Pp]ostbus\\s\\d{1,5})",
"regexp_pattern": "([Pp]ostbus\\s\\d{1,5}(\\.\\d{2,4})?)",
"tag": "locatie"
}
},
Expand Down Expand Up @@ -451,12 +472,16 @@
}
},
"age": {
"annotator_type": "regexp",
"annotator_type": "custom",
"group": "ages",
"args": {
"regexp_pattern": "(?i)((((\\d-|\\d\\d-))?(\\d[,\\.]\\d|\\d{1,3}))([ -](jarige|jarig|jaar)))(?!\\w)(?! (geleden|na|aanwezig|getrouwd|gestopt|gerookt|gebruikt|gestaakt))",
"module": "deduce.annotator",
"class": "RegexpPseudoAnnotator",
"regexp_pattern": "(?i)(?<![\\d,\\.])((1?\\d?\\d)([\\.,]5)?(-(1?\\d?\\d)([\\.,]5)?)?)([ -](jarige|jarig|jaar|jr))(?!\\w)",
"pre_pseudo": ["sinds", "vanaf", "controle", "policontrole", "gedurende", "de", "over", "elke", "nog", "na", "al", "up", "ongeveer", "<"],
"post_pseudo": ["geleden", "na", "naar", "nadien", "aanwezig", "getrouwd", "gestopt", "gerookt", "gebruikt", "gestaakt"],
"tag": "leeftijd",
"capturing_group": 2
"capturing_group": 1
}
},
"bsn": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44519,6 +44519,7 @@ Van Broekhoven Fysiotherapie
Van Broekhoven Fysiotherapie, Etten-Leur
Van Broekhoven Fysiotherapie, Roosendaal
Van Burken-Psycholoog
Van Creveldkliniek
Van Daalen Optiek
Van Dalen Voet&Schoencentrum
Van Dam Huis - Centrum voor Antroposofie en Gezondheidszorg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194958,6 +194958,7 @@ Van Burken-Psijcholoog
Van Burken-Psycholoog
Van BurkenPsijcholoog
Van BurkenPsycholoog
Van Creveldkliniek
Van Daalen Optiek
Van Dalen Voet&Schoencentrum
Van Dam Huis Centrum voor Antroposofie en Gezondheidszorg
Expand Down
3 changes: 3 additions & 0 deletions deduce-data/lookup_lists/institutions/hospital_abbr.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
AMC
AZU
CMH
Diak
EKZ
EMC
ETZ
JBZ
Expand All @@ -11,6 +13,7 @@ MUMC
PMC
UMC
UMCG
UMCN
UMCU
VMC
VUMC
Expand Down
80 changes: 80 additions & 0 deletions deduce-data/lookup_lists/institutions/hospital_long.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

'T Catharina Gasthuis
'T Catharina Kliniek
'T Catharina Klinieken
Expand Down Expand Up @@ -1236,7 +1237,29 @@ Diaconessenziekenhuis
Diaconessenziekenhuizen
Diaconessenzkh
Diaconessenzkh.
Diakonessen
Diakonessen Gasthuis
Diakonessen Kliniek
Diakonessen Klinieken
Diakonessen Ziekenhuis
Diakonessen Ziekenhuizen
Diakonessen Zkh
Diakonessen Zkh.
Diakonessen gasthuis
Diakonessen kliniek
Diakonessen klinieken
Diakonessen ziekenhuis
Diakonessen ziekenhuizen
Diakonessen zkh
Diakonessen zkh.
Diakonessengasthuis
Diakonessenhuis
Diakonessenkliniek
Diakonessenklinieken
Diakonessenziekenhuis
Diakonessenziekenhuizen
Diakonessenzkh
Diakonessenzkh.
Dijklander
Dijklander Gasthuis
Dijklander Kliniek
Expand Down Expand Up @@ -1534,6 +1557,7 @@ Gasthuis Bernhoven
Gasthuis De Gelderse Vallei
Gasthuis Enschede
Gasthuis Gelderse Vallei
Gasthuis Hilversum
Gasthuis Isselwaerde
Gasthuis Johannes De Deo
Gasthuis Knol
Expand Down Expand Up @@ -2402,6 +2426,7 @@ Kliniek Bernhoven
Kliniek De Gelderse Vallei
Kliniek Enschede
Kliniek Gelderse Vallei
Kliniek Hilversum
Kliniek Isselwaerde
Kliniek Johannes De Deo
Kliniek Knol
Expand Down Expand Up @@ -2566,6 +2591,28 @@ Lievensbergziekenhuis
Lievensbergziekenhuizen
Lievensbergzkh
Lievensbergzkh.
Lorentz
Lorentz Gasthuis
Lorentz Kliniek
Lorentz Klinieken
Lorentz Ziekenhuis
Lorentz Ziekenhuizen
Lorentz Zkh
Lorentz Zkh.
Lorentz gasthuis
Lorentz kliniek
Lorentz klinieken
Lorentz ziekenhuis
Lorentz ziekenhuizen
Lorentz zkh
Lorentz zkh.
Lorentzgasthuis
Lorentzkliniek
Lorentzklinieken
Lorentzziekenhuis
Lorentzziekenhuizen
Lorentzzkh
Lorentzzkh.
Lucas Andreas
Lucas Andreas Gasthuis
Lucas Andreas Kliniek
Expand Down Expand Up @@ -2770,6 +2817,7 @@ Militair Hospitaal Dokter A Mathijsen
Militair Hospitaal Dokter A Mathysen
Militair Hospitaal Dokter A. Mathijsen
Militair Hospitaal Dokter A. Mathysen
Máxima
Máxima MC
Máxima Medisch Centrum
Nebo
Expand Down Expand Up @@ -2988,6 +3036,27 @@ PW. Janssenziekenhuizen
PW. Janssenzkh
PW. Janssenzkh.
Parkzicht
Pasteur Gasthuis
Pasteur Kliniek
Pasteur Klinieken
Pasteur Ziekenhuis
Pasteur Ziekenhuizen
Pasteur Zkh
Pasteur Zkh.
Pasteur gasthuis
Pasteur kliniek
Pasteur klinieken
Pasteur ziekenhuis
Pasteur ziekenhuizen
Pasteur zkh
Pasteur zkh.
Pasteurgasthuis
Pasteurkliniek
Pasteurklinieken
Pasteurziekenhuis
Pasteurziekenhuizen
Pasteurzkh
Pasteurzkh.
Pieter Pauw Gasthuis
Pieter Pauw Kliniek
Pieter Pauw Klinieken
Expand Down Expand Up @@ -5953,6 +6022,7 @@ Twenteborgziekenhuis
Twenteborgziekenhuizen
Twenteborgzkh
Twenteborgzkh.
UMC
UMC Radboud
UMC Groningen
UMC Sint Radboud
Expand All @@ -5962,6 +6032,7 @@ UMC Utrecht
UMC sint Radboud
UMC st Radboud
UMC st. Radboud
Universitair MC
Universitair MC Radboud
Universitair MC Groningen
Universitair MC Sint Radboud
Expand All @@ -5971,6 +6042,7 @@ Universitair MC Utrecht
Universitair MC sint Radboud
Universitair MC st Radboud
Universitair MC st. Radboud
Universitair Medisch Centrum
Universitair Medisch Centrum Radboud
Universitair Medisch Centrum Groningen
Universitair Medisch Centrum Sint Radboud
Expand Down Expand Up @@ -6325,6 +6397,7 @@ Ziekenhuis Bernhoven
Ziekenhuis De Gelderse Vallei
Ziekenhuis Enschede
Ziekenhuis Gelderse Vallei
Ziekenhuis Hilversum
Ziekenhuis Isselwaerde
Ziekenhuis Johannes De Deo
Ziekenhuis Knol
Expand Down Expand Up @@ -6368,6 +6441,7 @@ Zkh Bernhoven
Zkh De Gelderse Vallei
Zkh Enschede
Zkh Gelderse Vallei
Zkh Hilversum
Zkh Isselwaerde
Zkh Johannes De Deo
Zkh Knol
Expand Down Expand Up @@ -6409,6 +6483,7 @@ Zkh. Bernhoven
Zkh. De Gelderse Vallei
Zkh. Enschede
Zkh. Gelderse Vallei
Zkh. Hilversum
Zkh. Isselwaerde
Zkh. Johannes De Deo
Zkh. Knol
Expand Down Expand Up @@ -6610,6 +6685,7 @@ gasthuis Bernhoven
gasthuis De Gelderse Vallei
gasthuis Enschede
gasthuis Gelderse Vallei
gasthuis Hilversum
gasthuis Isselwaerde
gasthuis Johannes De Deo
gasthuis Knol
Expand Down Expand Up @@ -6695,6 +6771,7 @@ kliniek Bernhoven
kliniek De Gelderse Vallei
kliniek Enschede
kliniek Gelderse Vallei
kliniek Hilversum
kliniek Isselwaerde
kliniek Johannes De Deo
kliniek Knol
Expand Down Expand Up @@ -9088,6 +9165,7 @@ ziekenhuis Bernhoven
ziekenhuis De Gelderse Vallei
ziekenhuis Enschede
ziekenhuis Gelderse Vallei
ziekenhuis Hilversum
ziekenhuis Isselwaerde
ziekenhuis Johannes De Deo
ziekenhuis Knol
Expand Down Expand Up @@ -9130,6 +9208,7 @@ zkh Bernhoven
zkh De Gelderse Vallei
zkh Enschede
zkh Gelderse Vallei
zkh Hilversum
zkh Isselwaerde
zkh Johannes De Deo
zkh Knol
Expand Down Expand Up @@ -9171,6 +9250,7 @@ zkh. Bernhoven
zkh. De Gelderse Vallei
zkh. Enschede
zkh. Gelderse Vallei
zkh. Hilversum
zkh. Isselwaerde
zkh. Johannes De Deo
zkh. Knol
Expand Down
Loading

0 comments on commit e43b062

Please sign in to comment.