Skip to content

Commit

Permalink
strict mode on conflict analyser: if True, then the function will ret…
Browse files Browse the repository at this point in the history
…urn True if there

                                             are multiple mention confidences for a given string, regardless of case sensitivity
  • Loading branch information
RichJackson committed Jul 3, 2024
1 parent 248be39 commit 7cecbbf
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions kazu/ontology_preprocessing/curation_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,8 @@ def check_for_case_conflicts_across_resources(
of equal or higher rank than a case-sensitive one.
:param resources:
:param strict: if True, then the function will return True if there are any conflicts in case sensitivity, regardless of the mention confidence
:param strict: if True, then the function will return True if there
are multiple mention confidences for a given string, regardless of case sensitivity
:return: a set of conflicted subsets, and a set of clean resources.
"""

Expand Down Expand Up @@ -604,7 +605,8 @@ def _resource_set_has_case_conflicts(
"Egfr" -> ci and POSSIBLE
:param resources:
:param strict: if True, then the function will return True if there are any conflicts in case sensitivity, regardless of the mention confidence
:param strict: if True, then the function will return True if there
are multiple mention confidences for a given string, regardless of case sensitivity
:return:
"""
cs_conf_lookup = defaultdict(set)
Expand All @@ -620,15 +622,10 @@ def _resource_set_has_case_conflicts(
ci_confidences: set[MentionConfidence] = ci_conf_lookup.get(
cased_syn_string.lower(), set()
)
if (
len(ci_confidences) > 1
or len(cs_confidences) > 1
or (
len(ci_confidences) == 1
and len(cs_confidences) > 0
and min(cs_confidences) <= min(ci_confidences)
)
or ((len(ci_confidences) + len(cs_confidences)) > 1 and strict)
if len(ci_confidences) > 1 or (
len(ci_confidences) == 1
and len(cs_confidences) > 0
and (min(cs_confidences) <= min(ci_confidences) or strict)
):
return True
for ci_confidences in ci_conf_lookup.values():
Expand Down

0 comments on commit 7cecbbf

Please sign in to comment.