Autogram checker: Difference between revisions

m
Line 131:
Verify an autogram. Count punctuation if second argument is true, error messages if verbose
"""
function isautogram(txt, countpunctuation,; verbose = true)
s = lowercase(txt)
charcounts = counter(s)
stillneedmention = Dict(p[1] => isletter(p[1]) || p[1] != ' ' && countpunctuation ? p[2] : 0 for p in charcounts)
len = length(s)
s = " " * replace(s, sr"^\.(?:employs|composed|contains)" => "")
for mention in split(s, r"\s*,|:\s*")
mention = replace(mention, r" and$" => "")
4,107

edits