Closed ianzur closed 4 months ago
Thanks for posting this issue and a solution! This looks like an acceptable improvement to me. Yes, remove the print statements and extra blank lines. Can I get you to modify the doc string as well?
Change "If either citation is None, then return None." to "If either citation is None or empty after character removal and stripping, then return None."
As for sanitation, we just try to return what the source gives us.
https://github.com/MoseleyBioinformaticsLab/academic_tracker/blob/aeec3103185f1dd5385a2c762b8d8589b036f06b/src/academic_tracker/helper_functions.py#L688
The citation string inputs to this function may contain only whitespace
\xa0
characters. I do not know how this happens and this may be a configuration issue. The.strip()
call removes the whitespace resulting in divide by zero.I think the citation string should be sanitized/normalized before adding to dictionary. Otherwise, I can remove the print statements from the check I added and merge.
https://github.com/MoseleyBioinformaticsLab/academic_tracker/compare/main...ianzur:academic_tracker:citation-common-phrase-div-by-zero?expand=1
Thank you, Ian