INNER CODE UNIT · Python
fng_statistics_term_groups
rfc-st/humble · humble.py:396
def fng_statistics_term_groups(fng_incl, fng_term):
"""Compute the total of fingerprint headers per provided term.
It takes into account also the service; related to `-f` option.
"""
fng_matches = [match for line in fng_incl if
(match := re.search(RE_PATTERN[0], line)) and
fng_term.lower() in match[1].lower()]
fng_groups = sorted({match[1].strip() for match in fng_matches})
term_cnt = len(fng_matches)
return fng_groups, term_cnt
def fng_statistics_term_content(fng_groups, fng_term, term_cnt, fng_incl):
"""Compute percentage of fingerprint headers matching the search term.
Related to `-f` option.
"""