umcu / clinlp

A Python library for performing NLP on clinical text written in Dutch
GNU General Public License v3.0
33 stars 0 forks source link

Fuzzy matches should exclude interpunction and upper/lower casing switching #67

Open bramiozo opened 3 months ago

bramiozo commented 3 months ago

First this span

Geen longembolieën. Beiderzijds

is tagged as positive, then this span

Geen longembolieën

is tagged as negative.

The relevant phrases in the concept dictionary are: positive: Longembolieën beiderzijds negative: Geen longembolieën

with the following clinlp settings:

# add to 
nlp = spacy.blank("clinlp")
# Sentences
nlp.add_pipe("clinlp_sentencizer")
# Entity matcher
entity_matcher = nlp.add_pipe("clinlp_entity_matcher",  
                config={"fuzzy": 2, "fuzzy_min_len": 5, "proximity": 1})
entity_matcher.load_concepts(clinlp_concepts)
# Qualifiers
nlp.add_pipe("clinlp_context_algorithm")

Expected behavior

Direction of solution:

bramiozo commented 3 months ago

negative positve

bramiozo commented 2 months ago

@vmenger, ik ben bezig met dit issue. Ik zag overigens dat clinlp -> src/clinlp is verplaatst :)

p.s. of is het deze issue, naja he

vmenger commented 2 months ago

Cool, goed om te weten! De hele roadmap staat nu hier: https://github.com/orgs/umcu/projects/3 -- is gelijk wat uitnodigender naar externen die mee willen werken. Vul gerust aan (door issues aan te maken

bramiozo commented 3 weeks ago

thinking out loud/notitie: Exclusie van interpunctie in fuzzy/proximity matching kan gedaan worden door interpunctie tijdelijk te vervangen door een tokenreeks van voldoende lengte e.g. "SEP SEP SEP SEP SEP" :D. Beetje een belachelijke optie maar het werkt wel...

Het niet accepteren van case switching voor de fuzzy matching vereist een nieuw gecompileerde Levenshstein.

vmenger commented 3 weeks ago

Als alles goed werkt dan kijkt de fuzzy matching alleen binnen een token, was het niet de proximity matching die hier de interpunctie matchte? In dat geval is het wel makkelijker te fixen, door {"OP": "?"} te vervangen door iets wat geen punct (of wellicht ook sentence boundaries?) matcht..