medspacy
medspacy copied to clipboard
TargetRule wrong type for pattern?
Here https://github.com/medspacy/medspacy/blob/master/medspacy/target_matcher/target_rule.py it lists the type for pattern as pattern: Optional[Union[List[Dict[str, str]], str]] = None,.
But in spacy the dicts can have dicts. Here's my rule:
TargetRule("billybob", "SEABASS",
pattern=[{"LOWER": {"IN": ["taco","hotdog"]}}])
In this case, pattern is List[Dict[str,Dict]]. So maybe it should be changed to
pattern: Optional[Union[List[Dict[str, Union[Dict,str]]], str]] = None
or since that is pretty hard to read, maybe just
pattern: Optional[Union[List[Dict], str]] = None
agree