MCPcopy
hub / github.com/TheAlgorithms/Python / english_freq_match_score

Function english_freq_match_score

strings/frequency_finder.py:82–97  ·  view source on GitHub ↗

>>> english_freq_match_score('Hello World') 1

(message: str)

Source from the content-addressed store, hash-verified

80
81
82def english_freq_match_score(message: str) -> int:
83 """
84 >>> english_freq_match_score('Hello World')
85 1
86 """
87 freq_order = get_frequency_order(message)
88 match_score = 0
89 for common_letter in ETAOIN[:6]:
90 if common_letter in freq_order[:6]:
91 match_score += 1
92
93 for uncommon_letter in ETAOIN[-6:]:
94 if uncommon_letter in freq_order[-6:]:
95 match_score += 1
96
97 return match_score
98
99
100if __name__ == "__main__":

Callers

nothing calls this directly

Calls 1

get_frequency_orderFunction · 0.85

Tested by

no test coverage detected