Fix with_more_than_one_type_count counting concepts with exactly one type#575
Open
Chessing234 wants to merge 1 commit intoallenai:mainfrom
Open
Fix with_more_than_one_type_count counting concepts with exactly one type#575Chessing234 wants to merge 1 commit intoallenai:mainfrom
Chessing234 wants to merge 1 commit intoallenai:mainfrom
Conversation
…type export_umls_json.py prints per-concept summary statistics. The aliases block pairs 'one alias' (== 1) with 'more than one alias' (> 1). The types block pairs 'one type' (== 1) with 'more than one type' (>= 1), so every concept with >= 1 type is counted under both with_one_type_count and with_more_than_one_type_count, inflating the 'more than one type' statistic by the count of single-type concepts. Change >= 1 to > 1 to match the aliases pattern and the variable's name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
`scripts/export_umls_json.py` prints summary statistics per concept. The aliases block uses:
```python
with_one_alias_count += 1 if len(concept['aliases']) == 1 else 0
with_more_than_one_alias_count += 1 if len(concept['aliases']) > 1 else 0
```
but the types block uses `>= 1` for the "more than one" counter:
```python
with_one_type_count += 1 if len(concept['types']) == 1 else 0
with_more_than_one_type_count += 1 if len(concept['types']) >= 1 else 0
```
Root cause
`>= 1` is true for every concept with at least one type, so every single-type concept is counted under both `with_one_type_count` and `with_more_than_one_type_count`. The two buckets should be disjoint — matching the aliases pattern and the variable's own name.
Fix
Change `>= 1` to `> 1` so "more than one type" means strictly greater than one, mirroring the aliases block.