An autogram is a sentence that describes itself in the sense of providing an inventory of its own characters. An essential feature is the use of full cardinal number names such as "one", "two", etc., in recording character counts.

Autogram checker is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
Definition

Autograms are also called 'self-enumerating' or 'self-documenting' sentences. Whilst they usually just count letters of the alphabet, they can also count punctuation symbols as well.


Example

If punctuation is ignored, the following sentence is an autogram:

This sentence employs two a's, two c's, two d's, twenty-eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty-five s's, twenty-three t's, six v's, ten w's, two x's, five y's, and one z.


Task

Write a routine in your language to check whether or not a given sentence is an autogram and use it to test the above example (Sentence 1.) and also the following sentences:

2. This sentence employs two a's, two c's, two d's, twenty eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty five s's, twenty three t's, six v's, ten w's, two x's, five y's, and one z.

3. Only the fool would take trouble to verify that his sentence was composed of ten a's, three b's, four c's, four d's, forty-six e's, sixteen f's, four g's, thirteen h's, fifteen i's, two k's, nine l's, four m's, twenty-five n's, twenty-four o's, five p's, sixteen r's, forty-one s's, thirty-seven t's, ten u's, eight v's, eight w's, four x's, eleven y's, twenty-seven commas, twenty-three apostrophes, seven hyphens and, last but not least, a single !

4. This pangram contains four as, one b, two cs, one d, thirty es, six fs, five gs, seven hs, eleven is, one j, one k, two ls, two ms, eighteen ns, fifteen os, two ps, one q, five rs, twenty-seven ss, eighteen ts, two us, seven vs, eight ws, two xs, three ys, & one z.

5. This sentence contains one hundred and ninety-seven letters: four a's, one b, three c's, five d's, thirty-four e's, seven f's, one g, six h's, twelve i's, three l's, twenty-six n's, ten o's, ten r's, twenty-nine s's, nineteen t's, six u's, seven v's, four w's, four x's, five y's, and one z.

6. Thirteen e's, five f's, two g's, five h's, eight i's, two l's, three n's, six o's, six r's, twenty s's, twelve t's, three u's, four v's, six w's, four x's, two y's.

7. Fifteen e's, seven f's, four g's, six h's, eight i's, four n's, five o's, six r's, eighteen s's, eight t's, four u's, three v's, two w's, three x's.

8. Sixteen e's, five f's, three g's, six h's, nine i's, five n's, four o's, six r's, eighteen s's, eight t's, three u's, three v's, two w's, four z's.

Punctuation should be ignored in all cases except for sentences number 3. and 7. For task 3 and 7, punctuation counts must be checked, and some ('comma', 'apostrophe', 'hyphen') punctuation may be represented in the autogram using the spelled out english names for the punctuation and the checker must respect the inconsistent use of apostrophes in the spellings of the counts (while still counting apostrophes accurately) and must accept 'single' as a synonym for 'one'.

Note that the only difference between sentences 1. and 2. is that there are no hyphens in the latter.


Assumptions
  • Ignore capitalization.
  • Never count spaces or full stops.


If it helps you may also make the following simplifying assumptions:

  • No sentence will be such that there are more than 99 instances of any countable character.
  • If punctuation is to be allowed for, only commas, hyphens, apostrophes and exclamation marks need be counted.


Reference


Other tasks related to string operations:
Metrics
Counting
Remove/replace
Anagrams/Derangements/shuffling
Find/Search/Determine
Formatting
Song lyrics/poems/Mad Libs/phrases
Tokenize
Sequences



Chipmunk Basic

Translation of: FreeBASIC
Works with: Chipmunk Basic version 3.6.4

FreeBASIC

Dim Shared As String textnumbers(1 To 28, 1 To 2)
textnumbers(1, 1) = "single": textnumbers(1, 2) = "1"
textnumbers(2, 1) = "one": textnumbers(2, 2) = "1"
textnumbers(3, 1) = "two": textnumbers(3, 2) = "2"
textnumbers(4, 1) = "three": textnumbers(4, 2) = "3"
textnumbers(5, 1) = "four": textnumbers(5, 2) = "4"
textnumbers(6, 1) = "five": textnumbers(6, 2) = "5"
textnumbers(7, 1) = "six": textnumbers(7, 2) = "6"
textnumbers(8, 1) = "seven": textnumbers(8, 2) = "7"
textnumbers(9, 1) = "eight": textnumbers(9, 2) = "8"
textnumbers(10, 1) = "nine": textnumbers(10, 2) = "9"
textnumbers(11, 1) = "ten": textnumbers(11, 2) = "10"
textnumbers(12, 1) = "eleven": textnumbers(12, 2) = "11"
textnumbers(13, 1) = "twelve": textnumbers(13, 2) = "12"
textnumbers(14, 1) = "thirteen": textnumbers(14, 2) = "13"
textnumbers(15, 1) = "fourteen": textnumbers(15, 2) = "14"
textnumbers(16, 1) = "fifteen": textnumbers(16, 2) = "15"
textnumbers(17, 1) = "sixteen": textnumbers(17, 2) = "16"
textnumbers(18, 1) = "seventeen": textnumbers(18, 2) = "17"
textnumbers(19, 1) = "eighteen": textnumbers(19, 2) = "18"
textnumbers(20, 1) = "nineteen": textnumbers(20, 2) = "19"
textnumbers(21, 1) = "twenty": textnumbers(21, 2) = "20"
textnumbers(22, 1) = "thirty": textnumbers(22, 2) = "30"
textnumbers(23, 1) = "forty": textnumbers(23, 2) = "40"
textnumbers(24, 1) = "fifty": textnumbers(24, 2) = "50"
textnumbers(25, 1) = "sixty": textnumbers(25, 2) = "60"
textnumbers(26, 1) = "seventy": textnumbers(26, 2) = "70"
textnumbers(27, 1) = "eighty": textnumbers(27, 2) = "80"
textnumbers(28, 1) = "ninety": textnumbers(28, 2) = "90"

Function PhraseToInteger(txt As String) As Integer
    Dim As Integer i, j, n = 0, lastNum = 0
    Dim As String ch, word = ""
    
    For i = 1 To Len(txt)
        ch = Mid(txt, i, 1)
        If ch = " " Or ch = "-" Or i = Len(txt) Then
            If i = Len(txt) Then word += ch
            word = Trim(word) ' Eliminar espacios adicionales
            For j = 1 To 28
                If word = textnumbers(j, 1) Then 
                    If Val(textnumbers(j, 2)) < 100 Then
                        lastNum += Val(textnumbers(j, 2))
                    Else
                        lastNum = Val(textnumbers(j, 2))
                    End If
                    Exit For
                End If
            Next
            If word = "hundred" Then 
                lastNum *= 100
            Elseif ch = "-" Or (i = Len(txt) And lastNum > 0) Then
                n += lastNum
                lastNum = 0
            End If
            word = ""
        Else
            word &= ch
        End If
    Next
    Return n + lastNum
End Function

Function CountLetters(txt As String) As Integer
    Dim As Integer count = 0
    For i As Integer = 1 To Len(txt)
        Dim As String ch = Mid(txt, i, 1)
        If (Asc(ch) >= 97 And Asc(ch) <= 122) Or (Asc(ch) >= 65 And Asc(ch) <= 90) Then count += 1
    Next
    Return count
End Function

Function isAutogram(txt As String, countpunctuation As Boolean, verbose As Boolean = True) As Boolean
    Dim As Integer i
    Dim As String s = Lcase(txt)
    Dim As Integer charcounts(255) = {0}
    For i = 1 To Len(s)
        charcounts(Asc(Mid(s, i, 1))) += 1
    Next
    Dim As Integer stillneedmention(255) = {0}
    For i = 1 To 255
        If (i >= 97 And i <= 122) Or (countpunctuation And i <> 32) Then stillneedmention(i) = charcounts(i)
    Next
    
    Dim As String mentions(1 To 100)
    Dim As Integer mentionCount = 0
    Dim As String mention = ""
    For i = 1 To Len(s)
        Dim As String ch = Mid(s, i, 1)
        If ch = "," Or ch = ":" Then
            mentionCount += 1
            mentions(mentionCount) = mention
            mention = ""
        Else
            mention &= ch
        End If
    Next
    If mention <> "" Then
        mentionCount += 1
        mentions(mentionCount) = mention
    End If
    
    For i = 1 To mentionCount
        mention = mentions(i)
        Dim As Integer spos = Instrrev(mention, " ")
        Dim As Integer numfromtext = PhraseToInteger(Left(mention, spos - 1))
        If numfromtext = 0 Then Continue For
        Dim As String c = Mid(mention, spos + 1)
        If c = "letters" Then
            If numfromtext <> CountLetters(txt) Then
                If verbose Then Print "The total letter count (should be " & CountLetters(txt) & ") is incorrect."
                Return False
            End If
            Continue For
        End If
        Dim As Integer ch = Asc(Left(c, 1))
        If charcounts(ch) = numfromtext Then
            stillneedmention(ch) = 0
        Else
            If verbose Then Print "The count of " & Chr(ch) & " in the phrase is incorrect."
            Return False
        End If
    Next
    For i = 1 To 255
        If stillneedmention(i) > 0 Then
            If verbose Then Print "The letter and count " & Chr(i) & " was not mentioned in the counts in the phrase."
            Return False
        End If
    Next
    Return True
End Function

Dim As String testphrases(1 To 8) = { _
"This sentence employs two a's, two c's, two d's, twenty-eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty-five s's, twenty-three t's, six v's, ten w's, two x's, five y's, and one z.", _
"This sentence employs two a's, two c's, two d's, twenty eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty five s's, twenty three t's, six v's, ten w's, two x's, five y's, and one z.", _
"Only the fool would take trouble to verify that his sentence was composed of ten a's, three b's, four c's, four d's, forty-six e's, sixteen f's, four g's, thirteen h's, fifteen i's, two k's, nine l's, four m's, twenty-five n's, twenty-four o's, five p's, sixteen r's, forty-one s's, thirty-seven t's, ten u's, eight v's, eight w's, four x's, eleven y's, twenty-seven commas, twenty-three apostrophes, seven hyphens and, last but not least, a single !", _
"This pangram contains four as, one b, two cs, one d, thirty es, six fs, five gs, seven hs, eleven is, one j, one k, two ls, two ms, eighteen ns, fifteen os, two ps, one q, five rs, twenty-seven ss, eighteen ts, two us, seven vs, eight ws, two xs, three ys, & one z.", _
"This sentence contains one hundred and ninety-seven letters: four a's, one b, three c's, five d's, thirty-four e's, seven f's, one g, six h's, twelve i's, three l's, twenty-six n's, ten o's, ten r's, twenty-nine s's, nineteen t's, six u's, seven v's, four w's, four x's, five y's, and one z.", _
"Thirteen e's, five f's, two g's, five h's, eight i's, two l's, three n's, six o's, six r's, twenty s's, twelve t's, three u's, four v's, six w's, four x's, two y's.", _
"Fifteen e's, seven f's, four g's, six h's, eight i's, four n's, five o's, six r's, eighteen s's, eight t's, four u's, three v's, two w's, three x's.", _
"Sixteen e's, five f's, three g's, six h's, nine i's, five n's, four o's, six r's, eighteen s's, eight t's, three u's, three v's, two w's, four z's." }

Dim As Boolean noPunctuation(1 To 8) = {False, False, True, False, False, False, True, False}

For i As Integer = 1 To 8
    Dim As String ia = Iif(isAutogram(testphrases(i), noPunctuation(i)), " ", " not ")
    Print "Test phrase "; i; " is"; ia; !"a valid autogram.\n"
Next

Sleep
Output:
Test phrase  1 is a valid autogram.

Test phrase  2 is a valid autogram.

The count of c in the phrase is incorrect.
Test phrase  3 is not a valid autogram.

Test phrase  4 is a valid autogram.

Test phrase  5 is a valid autogram.

Test phrase  6 is a valid autogram.

The letter and count ' was not mentioned in the counts in the phrase.
Test phrase  7 is not a valid autogram.

The count of z in the phrase is incorrect.
Test phrase  8 is not a valid autogram.

J

The task asks us for a rough check, so we rely on normalization to implement the stable core of the algorithm. Also, we use us and uk from the Number names task and explicitly support autograms with character counts higher than 99 (though of course none appear in the task examples).

In other words, we explicitly ignore details which were not specified in the task description as requirements of all autograms.

Implementation:

NB. requires uk and us from rosettacode Number_names#J
normalize=: {{ tolower ' '(I.(tolower=toupper)y)}y }}
normalize=: tolower@#~ tolower~:toupper

autogram=: {{
  y=. normalize y
  counts=: #/.~ y
  letters=: counts (], '''s'#~1<[)each~.y
  usgrams=: letters (us@],' ',[)each counts
  ukgrams=: letters (uk@],' ',[)each counts
  */(+./@E.&normalize&y every usgrams) +. +./@E.&normalize&y every ukgrams
}}

NB. we use a different autogram requirement for some cases
normalizep=: tolower@#~ e.&(''',-!') +. tolower~:toupper
normalizep2=: rplc&('apostrophe';'''';'comma';',';'hyphen';'-';'exclamation point';'!')

autogramp=: {{
  y=. normalizep y
  counts=: #/.~ y
  letters=: counts (], '''s'#~1<[)each~.y
  usgrams=: letters (us@],' ',[)each counts
  ukgrams=: letters (uk@],' ',[)each counts
  grams=: (, rplc&('''s';'s')L:0) usgrams,:ukgrams
  grams=: (, }.@rplc&('Zone';'Zsingle')@('Z'&,)L:0) grams
  */+./+./@E.&(normalizep2 Y) every grams
}}

Task examples:

   autogram {{)n This sentence employs two a's, two c's, two d's, twenty-eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty-five s's, twenty-three t's, six v's, ten w's, two x's, five y's, and one z.}}
1
   autogram {{)n This sentence employs two a's, two c's, two d's, twenty eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty five s's, twenty three t's, six v's, ten w's, two x's, five y's, and one z.}}
1
   autogram {{)n Only the fool would take trouble to verify that his sentence was composed of ten a's, three b's, four c's, four d's, forty-six e's, sixteen f's, four g's, thirteen h's, fifteen i's, two k's, nine l's, four m's, twenty-five n's, twenty-four o's, five p's, sixteen r's, forty-one s's, thirty-seven t's, ten u's, eight v's, eight w's, four x's, eleven y's, twenty-seven commas, twenty-three apostrophes, seven hyphens and, last but not least, a single !}}
1
   autogramp {{)n This pangram contains four as, one b, two cs, one d, thirty es, six fs, five gs, seven hs, eleven is, one j, one k, two ls, two ms, eighteen ns, fifteen os, two ps, one q, five rs, twenty-seven ss, eighteen ts, two us, seven vs, eight ws, two xs, three ys, & one z.}}
0
   autogram {{)n This sentence contains one hundred and ninety-seven letters: four a's, one b, three c's, five d's, thirty-four e's, seven f's, one g, six h's, twelve i's, three l's, twenty-six n's, ten o's, ten r's, twenty-nine s's, nineteen t's, six u's, seven v's, four w's, four x's, five y's, and one z.}}
1
   autogram {{)n Thirteen e's, five f's, two g's, five h's, eight i's, two l's, three n's, six o's, six r's, twenty s's, twelve t's, three u's, four v's, six w's, four x's, two y's.}}
1
   autogramp {{)n Fifteen e's, seven f's, four g's, six h's, eight i's, four n's, five o's, six r's, eighteen s's, eight t's, four u's, three v's, two w's, three x's.}}
0
   autogram {{)n Sixteen e's, five f's, three g's, six h's, nine i's, five n's, four o's, six r's, eighteen s's, eight t's, three u's, three v's, two w's, four z's.}}
0

As an aside, this illustrates that rosettacode's J syntax highlighter does not properly handle J's {{)n delimited character literals (a recent language feature, introduced in J903).

Julia

Validating the total letter count when used.

""" Rosetta Code task rosettacode.org/mw/index.php?title=Autogram_checker """

using DataStructures

const textnumbers = Dict("single" => 1, "one" => 1, "two" => 2, "three" => 3, "four" => 4,
    "five" => 5, "six" => 6, "seven" => 7, "eight" => 8, "nine" => 9, "ten" => 10, "eleven" => 11,
    "twelve" => 12, "thirteen" => 13, "fourteen" => 14, "fifteen" => 15, "sixteen" => 16,
    "seventeen" => 17, "eighteen" => 18, "nineteen" => 19, "twenty" => 20, "thirty" => 30,
    "forty" => 40, "fifty" => 50, "sixty" => 60, "seventy" => 70, "eighty" => 80, "ninety" => 90)

"""
    function phrasetointeger(txt)

Convert text spelled-out numbers from 1 to 999
"""
function phrasetointeger(txt)
    words = split(txt, r"\W+")
    n = 0
    for w in words
    	n += get(textnumbers, w, 0)
        w == "hundred" && (n *= 100)
    end
    return n
end

"""
    function isautogram(txt, countpunctuation; verbose = true)

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)
    s = " " * replace(s, r"^\.(?:employs|composed|contains)" => "")
    for mention in split(s, r"\s*,|:\s*")
        mention = replace(mention, r" and$" => "")
        spos = findlast(isspace, mention)
        numfromtext = phrasetointeger(mention[begin:spos-1])
        numfromtext == 0 && continue
        c = mention[begin+spos:end]
        if c == "letters"
            if numfromtext != count(isletter, txt)   # verify a total letter count
                verbose && println("The total letter count (should be $(count(isletter, txt))) is incorrect.")
                return false
            end
            continue
        end
        ch = contains(c, "comma") ? ',' : contains(c, "apostrophe") ? '\'' : contains(c, "hyphen") ? '-' : Char(c[1])
        if charcounts[ch] == numfromtext   # verify an individual character count
            stillneedmention[ch] = 0
        else
            verbose && println("The count of $ch in the phrase is incorrect.")
            return false
        end
    end
    for p in stillneedmention
        if p[2] > 0  # a letter we counted was not counted by the sentence
            verbose && println("The letter and count $p was not mentioned in the counts in the phrase.")
            return false
        end
    end
    return true
end

for (i, t) in enumerate([
    ("This sentence employs two a's, two c's, two d's, twenty-eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty-five s's, twenty-three t's, six v's, ten w's, two x's, five y's, and one z.", false),
    ("This sentence employs two a's, two c's, two d's, twenty eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty five s's, twenty three t's, six v's, ten w's, two x's, five y's, and one z.", false),
    ("Only the fool would take trouble to verify that his sentence was composed of ten a's, three b's, four c's, four d's, forty-six e's, sixteen f's, four g's, thirteen h's, fifteen i's, two k's, nine l's, four m's, twenty-five n's, twenty-four o's, five p's, sixteen r's, forty-one s's, thirty-seven t's, ten u's, eight v's, eight w's, four x's, eleven y's, twenty-seven commas, twenty-three apostrophes, seven hyphens and, last but not least, a single !", true),
    ("This pangram contains four as, one b, two cs, one d, thirty es, six fs, five gs, seven hs, eleven is, one j, one k, two ls, two ms, eighteen ns, fifteen os, two ps, one q, five rs, twenty-seven ss, eighteen ts, two us, seven vs, eight ws, two xs, three ys, & one z.", false),
    ("This sentence contains one hundred and ninety-seven letters: four a's, one b, three c's, five d's, thirty-four e's, seven f's, one g, six h's, twelve i's, three l's, twenty-six n's, ten o's, ten r's, twenty-nine s's, nineteen t's, six u's, seven v's, four w's, four x's, five y's, and one z.", false),
    ("Thirteen e's, five f's, two g's, five h's, eight i's, two l's, three n's, six o's, six r's, twenty s's, twelve t's, three u's, four v's, six w's, four x's, two y's.", false),
    ("Fifteen e's, seven f's, four g's, six h's, eight i's, four n's, five o's, six r's, eighteen s's, eight t's, four u's, three v's, two w's, three x's.", true),
    ("Sixteen e's, five f's, three g's, six h's, nine i's, five n's, four o's, six r's, eighteen s's, eight t's, three u's, three v's, two w's, four z's.", false),
   ])
    println("Test phrase $i is", isautogram(t[1], t[2]) ? " " : " not ", "a valid autogram.\n")
end
Output:
Test phrase 1 is a valid autogram.

Test phrase 2 is a valid autogram.

Test phrase 3 is a valid autogram.

Test phrase 4 is a valid autogram.

Test phrase 5 is a valid autogram.

Test phrase 6 is a valid autogram.

The letter and count '\'' => 14 was not mentioned in the counts in the phrase.
Test phrase 7 is not a valid autogram.

The count of z in the phrase is incorrect.
Test phrase 8 is not a valid autogram.

Nim

Translation of: Wren
import std/[algorithm, sequtils, strformat, strutils, tables]

const

  Numbers = {"fourteen": "14", "sixteen": "16",  "seventeen": "17", "eighteen": "18",
             "nineteen": "19", "sixty": "60",    "seventy": "70",   "eighty": "80",
             "ninety": "90",   "one": "1",       "two": "2",        "three": "3",
             "four": "4",      "five": "5",      "six": "6",        "seven": "7",
             "eight": "8",     "nine": "9",      "ten": "10",       "eleven": "11",
             "twelve": "12",   "thirteen": "13", "fifteen": "15",   "twenty": "20",
             "thirty": "30",   "forty": "40",    "fifty": "50",     "single": "1"}.toOrderedTable

  Punctuation = {"comma": ",", "hyphen": "-", "apostrophe": "'", "exclamation": "!"}.toTable

  LowerLetters = {'a'..'z'}
  Symbols = {',', '-', '\'', '!'}

proc autogram(sentence: string; ignorePunct: bool) =
  echo &"Sentence:\n{sentence}"
  echo &"""Ignore punctuation: {["no", "yes"][ord(ignorePunct)]}"""
  var s = sentence.toLowerAscii
  # Get actual character counts.
  let chars = if ignorePunct: LowerLetters else: LowerLetters + Symbols
  var ctable1: CountTable[char]
  for c in s:
    if c in chars:
      ctable1.inc(c)
  let keys1 = sorted(ctable1.keys.toSeq)   # Sort into lexicographical order.
  let charCounts1 = keys1.mapIt((it, ctable1[it])).join(" ")
  echo "\nActual character counts:"
  echo charCounts1

  for text, value in Numbers.pairs:
    s = s.replace(text, value)
  if not ignorePunct:
    for punct in Punctuation.pairs:
      s = s.replace(punct[0], punct[1])
  let words = s.split(' ')
  var ctable2: CountTable[char]
  let wc = words.len
  var i = 0
  while i < wc - 1:
    if words[i].all(isDigit):
      if words[i+1].all(isDigit) and i + 2 < wc:
        let count = words[i].parseInt() + words[i+1].parseInt()
        let ch = words[i + 2][0]
        ctable2[ch] = count
        inc i, 3
      else:
        let count = words[i].parseInt()
        let ch = words[i + 1][0]
        ctable2[ch] = count
        inc i, 2
    elif '-' in words[i]:
      let split = words[i].split('-')
      if split[0].all(isDigit) and split[1].all(isDigit):
        let count = split[0].parseInt() + split[1].parseInt()
        let ch = words[i + 1][0]
        ctable2[ch] = count
        inc i, 2
      else:
        inc i
    else:
      inc i

  let keys2 = sorted(ctable2.keys.toSeq)
  let charCounts2 = keys2.mapIt((it, ctable2[it])).join(" ")
  echo "\nPurported character counts:"
  echo charCounts2
  echo &"\nIs autogram? {charCounts1 == charCounts2}"

const Tests = [
    ("This sentence employs two a's, two c's, two d's, twenty-eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty-five s's, twenty-three t's, six v's, ten w's, two x's, five y's, and one z.", true),
    ("This sentence employs two a's, two c's, two d's, twenty eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty five s's, twenty three t's, six v's, ten w's, two x's, five y's, and one z.", true),
    ("Only the fool would take trouble to verify that his sentence was composed of ten a's, three b's, four c's, four d's, forty-six e's, sixteen f's, four g's, thirteen h's, fifteen i's, two k's, nine l's, four m's, twenty-five n's, twenty-four o's, five p's, sixteen r's, forty-one s's, thirty-seven t's, ten u's, eight v's, eight w's, four x's, eleven y's, twenty-seven commas, twenty-three apostrophes, seven hyphens and, last but not least, a single !", false),
    ("This pangram contains four as, one b, two cs, one d, thirty es, six fs, five gs, seven hs, eleven is, one j, one k, two ls, two ms, eighteen ns, fifteen os, two ps, one q, five rs, twenty-seven ss, eighteen ts, two us, seven vs, eight ws, two xs, three ys, & one z.", true),
    ("This sentence contains one hundred and ninety-seven letters: four a's, one b, three c's, five d's, thirty-four e's, seven f's, one g, six h's, twelve i's, three l's, twenty-six n's, ten o's, ten r's, twenty-nine s's, nineteen t's, six u's, seven v's, four w's, four x's, five y's, and one z.", true),
    ("Thirteen e's, five f's, two g's, five h's, eight i's, two l's, three n's, six o's, six r's, twenty s's, twelve t's, three u's, four v's, six w's, four x's, two y's.", true),
    ("Fifteen e's, seven f's, four g's, six h's, eight i's, four n's, five o's, six r's, eighteen s's, eight t's, four u's, three v's, two w's, three x's.", false),
    ("Sixteen e's, five f's, three g's, six h's, nine i's, five n's, four o's, six r's, eighteen s's, eight t's, three u's, three v's, two w's, four z's.", true)
    ]

for t in Tests:
  autogram(t[0], t[1])
  echo repeat('=', 80)
Output:
Sentence:
This sentence employs two a's, two c's, two d's, twenty-eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty-five s's, twenty-three t's, six v's, ten w's, two x's, five y's, and one z.
Ignore punctuation: yes

Actual character counts:
('a', 2) ('c', 2) ('d', 2) ('e', 28) ('f', 5) ('g', 3) ('h', 8) ('i', 11) ('l', 3) ('m', 2) ('n', 13) ('o', 9) ('p', 2) ('r', 5) ('s', 25) ('t', 23) ('v', 6) ('w', 10) ('x', 2) ('y', 5) ('z', 1)

Purported character counts:
('a', 2) ('c', 2) ('d', 2) ('e', 28) ('f', 5) ('g', 3) ('h', 8) ('i', 11) ('l', 3) ('m', 2) ('n', 13) ('o', 9) ('p', 2) ('r', 5) ('s', 25) ('t', 23) ('v', 6) ('w', 10) ('x', 2) ('y', 5) ('z', 1)

Is autogram? true
================================================================================
Sentence:
This sentence employs two a's, two c's, two d's, twenty eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty five s's, twenty three t's, six v's, ten w's, two x's, five y's, and one z.
Ignore punctuation: yes

Actual character counts:
('a', 2) ('c', 2) ('d', 2) ('e', 28) ('f', 5) ('g', 3) ('h', 8) ('i', 11) ('l', 3) ('m', 2) ('n', 13) ('o', 9) ('p', 2) ('r', 5) ('s', 25) ('t', 23) ('v', 6) ('w', 10) ('x', 2) ('y', 5) ('z', 1)

Purported character counts:
('a', 2) ('c', 2) ('d', 2) ('e', 28) ('f', 5) ('g', 3) ('h', 8) ('i', 11) ('l', 3) ('m', 2) ('n', 13) ('o', 9) ('p', 2) ('r', 5) ('s', 25) ('t', 23) ('v', 6) ('w', 10) ('x', 2) ('y', 5) ('z', 1)

Is autogram? true
================================================================================
Sentence:
Only the fool would take trouble to verify that his sentence was composed of ten a's, three b's, four c's, four d's, forty-six e's, sixteen f's, four g's, thirteen h's, fifteen i's, two k's, nine l's, four m's, twenty-five n's, twenty-four o's, five p's, sixteen r's, forty-one s's, thirty-seven t's, ten u's, eight v's, eight w's, four x's, eleven y's, twenty-seven commas, twenty-three apostrophes, seven hyphens and, last but not least, a single !
Ignore punctuation: no

Actual character counts:
('!', 1) ('\'', 23) (',', 27) ('-', 7) ('a', 10) ('b', 3) ('c', 4) ('d', 4) ('e', 46) ('f', 16) ('g', 4) ('h', 13) ('i', 15) ('k', 2) ('l', 9) ('m', 4) ('n', 25) ('o', 24) ('p', 5) ('r', 16) ('s', 41) ('t', 37) ('u', 10) ('v', 8) ('w', 8) ('x', 4) ('y', 11)

Purported character counts:
('!', 1) ('\'', 23) (',', 27) ('-', 7) ('a', 10) ('b', 3) ('c', 4) ('d', 4) ('e', 46) ('f', 16) ('g', 4) ('h', 13) ('i', 15) ('k', 2) ('l', 9) ('m', 4) ('n', 25) ('o', 24) ('p', 5) ('r', 16) ('s', 41) ('t', 37) ('u', 10) ('v', 8) ('w', 8) ('x', 4) ('y', 11)

Is autogram? true
================================================================================
Sentence:
This pangram contains four as, one b, two cs, one d, thirty es, six fs, five gs, seven hs, eleven is, one j, one k, two ls, two ms, eighteen ns, fifteen os, two ps, one q, five rs, twenty-seven ss, eighteen ts, two us, seven vs, eight ws, two xs, three ys, & one z.
Ignore punctuation: yes

Actual character counts:
('a', 4) ('b', 1) ('c', 2) ('d', 1) ('e', 30) ('f', 6) ('g', 5) ('h', 7) ('i', 11) ('j', 1) ('k', 1) ('l', 2) ('m', 2) ('n', 18) ('o', 15) ('p', 2) ('q', 1) ('r', 5) ('s', 27) ('t', 18) ('u', 2) ('v', 7) ('w', 8) ('x', 2) ('y', 3) ('z', 1)

Purported character counts:
('a', 4) ('b', 1) ('c', 2) ('d', 1) ('e', 30) ('f', 6) ('g', 5) ('h', 7) ('i', 11) ('j', 1) ('k', 1) ('l', 2) ('m', 2) ('n', 18) ('o', 15) ('p', 2) ('q', 1) ('r', 5) ('s', 27) ('t', 18) ('u', 2) ('v', 7) ('w', 8) ('x', 2) ('y', 3) ('z', 1)

Is autogram? true
================================================================================
Sentence:
This sentence contains one hundred and ninety-seven letters: four a's, one b, three c's, five d's, thirty-four e's, seven f's, one g, six h's, twelve i's, three l's, twenty-six n's, ten o's, ten r's, twenty-nine s's, nineteen t's, six u's, seven v's, four w's, four x's, five y's, and one z.
Ignore punctuation: yes

Actual character counts:
('a', 4) ('b', 1) ('c', 3) ('d', 5) ('e', 34) ('f', 7) ('g', 1) ('h', 6) ('i', 12) ('l', 3) ('n', 26) ('o', 10) ('r', 10) ('s', 29) ('t', 19) ('u', 6) ('v', 7) ('w', 4) ('x', 4) ('y', 5) ('z', 1)

Purported character counts:
('a', 4) ('b', 1) ('c', 3) ('d', 5) ('e', 34) ('f', 7) ('g', 1) ('h', 6) ('i', 12) ('l', 3) ('n', 26) ('o', 10) ('r', 10) ('s', 29) ('t', 19) ('u', 6) ('v', 7) ('w', 4) ('x', 4) ('y', 5) ('z', 1)

Is autogram? true
================================================================================
Sentence:
Thirteen e's, five f's, two g's, five h's, eight i's, two l's, three n's, six o's, six r's, twenty s's, twelve t's, three u's, four v's, six w's, four x's, two y's.
Ignore punctuation: yes

Actual character counts:
('e', 13) ('f', 5) ('g', 2) ('h', 5) ('i', 8) ('l', 2) ('n', 3) ('o', 6) ('r', 6) ('s', 20) ('t', 12) ('u', 3) ('v', 4) ('w', 6) ('x', 4) ('y', 2)

Purported character counts:
('e', 13) ('f', 5) ('g', 2) ('h', 5) ('i', 8) ('l', 2) ('n', 3) ('o', 6) ('r', 6) ('s', 20) ('t', 12) ('u', 3) ('v', 4) ('w', 6) ('x', 4) ('y', 2)

Is autogram? true
================================================================================
Sentence:
Fifteen e's, seven f's, four g's, six h's, eight i's, four n's, five o's, six r's, eighteen s's, eight t's, four u's, three v's, two w's, three x's.
Ignore punctuation: no

Actual character counts:
('\'', 14) (',', 13) ('e', 15) ('f', 7) ('g', 4) ('h', 6) ('i', 8) ('n', 4) ('o', 5) ('r', 6) ('s', 18) ('t', 8) ('u', 4) ('v', 3) ('w', 2) ('x', 3)

Purported character counts:
('e', 15) ('f', 7) ('g', 4) ('h', 6) ('i', 8) ('n', 4) ('o', 5) ('r', 6) ('s', 18) ('t', 8) ('u', 4) ('v', 3) ('w', 2) ('x', 3)

Is autogram? false
================================================================================
Sentence:
Sixteen e's, five f's, three g's, six h's, nine i's, five n's, four o's, six r's, eighteen s's, eight t's, three u's, three v's, two w's, four z's.
Ignore punctuation: yes

Actual character counts:
('e', 16) ('f', 5) ('g', 3) ('h', 6) ('i', 9) ('n', 5) ('o', 4) ('r', 6) ('s', 18) ('t', 8) ('u', 3) ('v', 3) ('w', 2) ('x', 3) ('z', 1)

Purported character counts:
('e', 16) ('f', 5) ('g', 3) ('h', 6) ('i', 9) ('n', 5) ('o', 4) ('r', 6) ('s', 18) ('t', 8) ('u', 3) ('v', 3) ('w', 2) ('z', 4)

Is autogram? false
================================================================================

Perl

use v5.36;
use experimental <builtin for_list>;
use Sub::Util 'subname';
use List::Util 'sum';

my %nums = (
'zero' => 0, 'single' => 1, 'one' => 1, 'two' => 2, 'three' => 3, 'four' => 4, 'five' => 5, 'six' => 6,
'seven' => 7, 'eight' => 8, 'nine' => 9, 'ten' => 10, 'eleven' => 11, 'twelve' => 12, 'thirteen' => 13,
'fourteen' => 14, 'fifteen' => 15, 'sixteen' => 16, 'seventeen' => 17, 'eighteen' => 18, 'nineteen' => 19,
'twenty' => 20, 'thirty' => 30, 'forty' => 40, 'fifty' => 50, 'sixty' => 60, 'seventy' => 70, 'eighty' => 80,
'ninety' => 90, 'hundred' => 100,
);

my @tests = (
    \&punctuation, "This sentence employs two a's, two c's, two d's, twenty-eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty-five s's, twenty-three t's, six v's, ten w's, two x's, five y's, and one z.",
    \&punctuation, "This sentence employs two a's, two c's, two d's, twenty eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty five s's, twenty three t's, six v's, ten w's, two x's, five y's, and one z.",
    '',            "Only the fool would take trouble to verify that his sentence was composed of ten a's, three b's, four c's, four d's, forty-six e's, sixteen f's, four g's, thirteen h's, fifteen i's, two k's, nine l's, four m's, twenty-five n's, twenty-four o's, five p's, sixteen r's, forty-one s's, thirty-seven t's, ten u's, eight v's, eight w's, four x's, eleven y's, twenty-seven commas, twenty-three apostrophes, seven hyphens and, last but not least, a single !",
    \&punctuation, "This pangram contains four as, one b, two cs, one d, thirty es, six fs, five gs, seven hs, eleven is, one j, one k, two ls, two ms, eighteen ns, fifteen os, two ps, one q, five rs, twenty-seven ss, eighteen ts, two us, seven vs, eight ws, two xs, three ys, & one z.",
    \&punctuation, "This sentence contains one hundred and ninety-seven letters: four a's, one b, three c's, five d's, thirty-four e's, seven f's, one g, six h's, twelve i's, three l's, twenty-six n's, ten o's, ten r's, twenty-nine s's, nineteen t's, six u's, seven v's, four w's, four x's, five y's, and one z.",
    \&punctuation, "Thirteen e's, five f's, two g's, five h's, eight i's, two l's, three n's, six o's, six r's, twenty s's, twelve t's, three u's, four v's, six w's, four x's, two y's.",
    '',            "Fifteen e's, seven f's, four g's, six h's, eight i's, four n's, five o's, six r's, eighteen s's, eight t's, four u's, three v's, two w's, three x's.",
    \&punctuation, "Sixteen e's, five f's, three g's, six h's, nine i's, five n's, four o's, six r's, eighteen s's, eight t's, three u's, three v's, two w's, four z's."
);

sub punctuation ($text) { $text =~ s/\W//grx }
sub wrap { (shift) =~ s/(.{96}.*?\s)/$1\n/gr }

for my($filter, $text) (@tests) {
    my(%Claim, %Actual, $count_claim, $count_actual);
    my %Punc = ('apostrophe' => "'", 'hyphen' => '-', 'comma' => ',', 'exclamation' => '!');
    my $str = my $filtered = my $original = lc $text;
    $str =~ s/\!/exclamation/g;

    say wrap $text;
    my $filter_func = $filter ? subname( $filter ) =~ s/main:://r : '';
    say "\nNOT filtering out punctuation" unless $filter_func;

    $str =~ s/\bone ([a-z])[,.]\b/one $1's,/g;
    for my($word, $number) (%nums) { $str =~ s/ \b $word \b /$number/gix }
    $str =~ s/(\d0)[ \-](\d)/$1 + $2/gxe;
    $str =~ s/\b1 100 and (\d+)\b/100 + $1/e;
    $str =~ s/(\d+) ([a-z])['s,.]*\b/ $Claim{$2} = $1/ge;

    $filtered = &$filter($original) if $filter;
    $Actual{$_} = () = $filtered =~ /$_/g for keys %Claim;
    $count_claim  .= "$_($Claim{$_}) "  for sort keys %Claim;
    $count_actual .= "$_($Actual{$_}) " for sort keys %Actual;

    unless ($filter_func) {
        for (sort keys %Punctuation) {
            $str =~ m/(\d+) ($_)/;
            $count_claim  .= "$Punctuation{$2}($1) " if $1 and $Punctuation{$2};
            my $n = () = $filtered =~ /$Punctuation{$_}/g;
            $count_actual .= "$Punctuation{$_}($n) " if $n;
        }
    }

    say "\nClaimed character counts:\n" . wrap $count_claim;
    say "\nActual character counts:\n"  . wrap $count_actual;

    say "\nAutogram? ". (my $AG = $count_claim eq $count_actual ? 'True' : 'False');
    say "Autogram? " . ($AG and $1 == $orig =~ tr/a-z// ? 'True' : 'False') . ' (with added sentence length condition)'
        if $str =~ /(\d+) letters/;
    say "\n" . '=' x 101;
}
Output:
This sentence employs two a's, two c's, two d's, twenty-eight e's, five f's, three g's, eight h's,
eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty-five s's,
twenty-three t's, six v's, ten w's, two x's, five y's, and one z.

Claimed character counts:
a(2) c(2) d(2) e(28) f(5) g(3) h(8) i(11) l(3) m(2) n(13) o(9) p(2) r(5) s(25) t(23) v(6) w(10) x(2)
y(5) z(1)

Actual character counts:
a(2) c(2) d(2) e(28) f(5) g(3) h(8) i(11) l(3) m(2) n(13) o(9) p(2) r(5) s(25) t(23) v(6) w(10) x(2)
y(5) z(1)

Autogram? True

=====================================================================================================
This sentence employs two a's, two c's, two d's, twenty eight e's, five f's, three g's, eight h's,
eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty five s's, twenty
three t's, six v's, ten w's, two x's, five y's, and one z.

Claimed character counts:
a(2) c(2) d(2) e(28) f(5) g(3) h(8) i(11) l(3) m(2) n(13) o(9) p(2) r(5) s(25) t(23) v(6) w(10) x(2)
y(5) z(1)

Actual character counts:
a(2) c(2) d(2) e(28) f(5) g(3) h(8) i(11) l(3) m(2) n(13) o(9) p(2) r(5) s(25) t(23) v(6) w(10) x(2)
y(5) z(1)

Autogram? True

=====================================================================================================
This sentence employs two a's, two c's, two d's, twenty eight e's, five f's, three g's, eight h's,
eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty five s's, twenty
three t's, six v's, ten w's, two x's, five y's, and one z.

Claimed character counts:
a(2) c(2) d(2) e(28) f(5) g(3) h(8) i(11) l(3) m(2) n(13) o(9) p(2) r(5) s(25) t(23) v(6) w(10) x(2)
y(5) z(1)

Actual character counts:
a(2) c(2) d(2) e(28) f(5) g(3) h(8) i(11) l(3) m(2) n(13) o(9) p(2) r(5) s(25) t(23) v(6) w(10) x(2)
y(5) z(1)

Autogram? True

=====================================================================================================
Only the fool would take trouble to verify that his sentence was composed of ten a's, three b's,
four c's, four d's, forty-six e's, sixteen f's, four g's, thirteen h's, fifteen i's, two k's, nine
l's, four m's, twenty-five n's, twenty-four o's, five p's, sixteen r's, forty-one s's, thirty-seven
t's, ten u's, eight v's, eight w's, four x's, eleven y's, twenty-seven commas, twenty-three
apostrophes, seven hyphens and, last but not least, a single !

NOT filtering out punctuation

Claimed character counts:
a(10) b(3) c(4) d(4) e(46) f(16) g(4) h(13) i(15) k(2) l(9) m(4) n(25) o(24) p(5) r(16) s(41) t(37)
u(10) v(8) w(8) x(4) y(11) '(23) ,(27) !(1) -(7)

Actual character counts:
a(10) b(3) c(4) d(4) e(46) f(16) g(4) h(13) i(15) k(2) l(9) m(4) n(25) o(24) p(5) r(16) s(41) t(37)
u(10) v(8) w(8) x(4) y(11) '(23) ,(27) !(1) -(7)

Autogram? True

=====================================================================================================
This pangram contains four as, one b, two cs, one d, thirty es, six fs, five gs, seven hs, eleven
is, one j, one k, two ls, two ms, eighteen ns, fifteen os, two ps, one q, five rs, twenty-seven ss,
eighteen ts, two us, seven vs, eight ws, two xs, three ys, & one z.

Claimed character counts:
a(4) b(1) c(2) d(1) e(30) f(6) g(5) h(7) i(11) j(1) k(1) l(2) m(2) n(18) o(15) p(2) q(1) r(5) s(27)
t(18) u(2) v(7) w(8) x(2) y(3) z(1)

Actual character counts:
a(4) b(1) c(2) d(1) e(30) f(6) g(5) h(7) i(11) j(1) k(1) l(2) m(2) n(18) o(15) p(2) q(1) r(5) s(27)
t(18) u(2) v(7) w(8) x(2) y(3) z(1)

Autogram? True

=====================================================================================================
This sentence contains one hundred and ninety-seven letters: four a's, one b, three c's, five d's,
thirty-four e's, seven f's, one g, six h's, twelve i's, three l's, twenty-six n's, ten o's, ten r's,
twenty-nine s's, nineteen t's, six u's, seven v's, four w's, four x's, five y's, and one z.

Claimed character counts:
a(4) b(1) c(3) d(5) e(34) f(7) g(1) h(6) i(12) l(3) n(26) o(10) r(10) s(29) t(19) u(6) v(7) w(4)
x(4) y(5) z(1)

Actual character counts:
a(4) b(1) c(3) d(5) e(34) f(7) g(1) h(6) i(12) l(3) n(26) o(10) r(10) s(29) t(19) u(6) v(7) w(4)
x(4) y(5) z(1)

Autogram? True
Autogram? True (with added sentence length condition)

=====================================================================================================
Thirteen e's, five f's, two g's, five h's, eight i's, two l's, three n's, six o's, six r's, twenty
s's, twelve t's, three u's, four v's, six w's, four x's, two y's.

Claimed character counts:
e(13) f(5) g(2) h(5) i(8) l(2) n(3) o(6) r(6) s(20) t(12) u(3) v(4) w(6) x(4) y(2)

Actual character counts:
e(13) f(5) g(2) h(5) i(8) l(2) n(3) o(6) r(6) s(20) t(12) u(3) v(4) w(6) x(4) y(2)

Autogram? True

=====================================================================================================
Fifteen e's, seven f's, four g's, six h's, eight i's, four n's, five o's, six r's, eighteen s's,
eight t's, four u's, three v's, two w's, three x's.

NOT filtering out punctuation

Claimed character counts:
e(15) f(7) g(4) h(6) i(8) n(4) o(5) r(6) s(18) t(8) u(4) v(3) w(2) x(3)

Actual character counts:
e(15) f(7) g(4) h(6) i(8) n(4) o(5) r(6) s(18) t(8) u(4) v(3) w(2) x(3) '(14) ,(13)

Autogram? False

=====================================================================================================
Sixteen e's, five f's, three g's, six h's, nine i's, five n's, four o's, six r's, eighteen s's,
eight t's, three u's, three v's, two w's, four z's.

Claimed character counts:
e(16) f(5) g(3) h(6) i(9) n(5) o(4) r(6) s(18) t(8) u(3) v(3) w(2) z(4)

Actual character counts:
e(16) f(5) g(3) h(6) i(9) n(5) o(4) r(6) s(18) t(8) u(3) v(3) w(2) z(1)

Autogram? False

=====================================================================================================

Phix

with javascript_semantics
constant tests = split(substitute("""
1. This sentence employs two a's, two c's, two d's, twenty-eight e's,
 five f's, three g's, eight h's, eleven i's, three l's, two m's,
 thirteen n's, nine o's, two p's, five r's, twenty-five s's,
 twenty-three t's, six v's, ten w's, two x's, five y's, and one z.
2. This sentence employs two a's, two c's, two d's, twenty eight e's,
 five f's, three g's, eight h's, eleven i's, three l's, two m's,
 thirteen n's, nine o's, two p's, five r's, twenty five s's,
 twenty three t's, six v's, ten w's, two x's, five y's, and one z.
3. Only the fool would take trouble to verify that his sentence was
 composed of ten a's, three b's, four c's, four d's, forty-six e's,
 sixteen f's, four g's, thirteen h's, fifteen i's, two k's, nine l's,
 four m's, twenty-five n's, twenty-four o's, five p's, sixteen r's,
 forty-one s's, thirty-seven t's, ten u's, eight v's, eight w's,
 four x's, eleven y's, twenty-seven commas, twenty-three apostrophes,
 seven hyphens and, last but not least, a single !
4. This pangram contains four as, one b, two cs, one d, thirty es,
 six fs, five gs, seven hs, eleven is, one j, one k, two ls, two ms,
 eighteen ns, fifteen os, two ps, one q, five rs, twenty-seven ss,
 eighteen ts, two us, seven vs, eight ws, two xs, three ys, & one z.
5. This sentence contains one hundred and ninety-seven letters: 
 four a's, one b, three c's, five d's, thirty-four e's, seven f's,
 one g, six h's, twelve i's, three l's, twenty-six n's, ten o's,
 ten r's, twenty-nine s's, nineteen t's, six u's, seven v's,
 four w's, four x's, five y's, and one z.
6. Thirteen e's, five f's, two g's, five h's, eight i's, two l's,
 three n's, six o's, six r's, twenty s's, twelve t's, three u's,
 four v's, six w's, four x's, two y's.
7. Fifteen e's, seven f's, four g's, six h's, eight i's, four n's,
 five o's, six r's, eighteen s's, eight t's, four u's, three v's,
 two w's, three x's.
8. Sixteen e's, five f's, three g's, six h's, nine i's, five n's,
 four o's, six r's, eighteen s's, eight t's, three u's, three v's,
 two w's, four z's.
""","\n "," "),"\n"),
numbers = 1&tagset(19)&tagset(90,20,10),
words = {"single"}&apply(true,ordinal,{numbers[2..$],true})
for s in tests do
    bool ignore_punctuation = not find(s[1],"37")
    assert(s[2..3]=". ")
    s = s[4..$]
    printf(1,"%s\n",{shorten(s,"",60)})
    sequence actual = repeat(0,255),
            claimed = repeat(0,255),
             claims = split_any(lower(s)," '&,-:.")
    for ch in s do
        if not find(ch," .")
        and (not find(ch,",'&!-:") or not ignore_punctuation) then
            ch = lower(ch)
            actual[ch] += 1
        end if
    end for
    integer w = 1, check_letters = 0
    while w<=length(claims) do
        string word = claims[w]
        w += 1
        integer k = find(word,words)
        if k then
            k = numbers[k]
            while w<=length(claims) do
                word = claims[w]
                w += 1
                integer l = find(word,words)
                if l then
                    k += numbers[l]
                elsif word="hundred" then
                    k *= 100
                elsif word!="and" then
                    l = find(word,{"commas","apostrophes","hyphens"})
                    if l then word = ",'-"[l..l] end if
                    if length(word)=1
                    or (length(word)=2 and word[2]='s') then
                        claimed[lower(word[1])] = k
                    elsif word="letters" then
                        check_letters = k
                    else
                        ?{word,k} // (placeholder)
                    end if
                    exit
                end if
            end while
        end if
    end while
    bool letters = check_letters=0 or check_letters=sum(actual),
         autogram = (claimed=actual) and letters
    string diff = ""
    if not autogram then
        string claim = "", act = ""
        for ch=1 to 255 do
            if claimed[ch]!=actual[ch] then
                claim &= sprintf("%c:%d ",{ch,claimed[ch]})
                act &= sprintf("%c:%d ",{ch,actual[ch]})
            end if
        end for
        if not letters then
            claim &= sprintf("letters:%d ",check_letters)
            act &= sprintf("letters:%d ",sum(actual))
        end if
        diff = sprintf("  (differences: claimed:%s, actual:%s)",{claim,act})
    elsif check_letters then
        integer lc = length(filter(s,"out"," -:,'."))
        diff = sprintf("  (%d letters)",lc)
    end if
    printf(1,"Autogram? %t%s\n\n",{autogram,diff})
end for
Output:
This sentence employs two a's, two c's, two d's, twenty-eigh...y-three t's, six v's, ten w's, two x's, five y's, and one z.
Autogram? true

This sentence employs two a's, two c's, two d's, twenty eigh...y three t's, six v's, ten w's, two x's, five y's, and one z.
Autogram? true

Only the fool would take trouble to verify that his sentence...ostrophes, seven hyphens and, last but not least, a single !
Autogram? true

This pangram contains four as, one b, two cs, one d, thirty ...n ts, two us, seven vs, eight ws, two xs, three ys, & one z.
Autogram? true

This sentence contains one hundred and ninety-seven letters:...six u's, seven v's, four w's, four x's, five y's, and one z.
Autogram? true  (197 letters)

Thirteen e's, five f's, two g's, five h's, eight i's, two l'...twelve t's, three u's, four v's, six w's, four x's, two y's.
Autogram? true

Fifteen e's, seven f's, four g's, six h's, eight i's, four n...een s's, eight t's, four u's, three v's, two w's, three x's.
Autogram? false  (differences: claimed:':0 ,:0 , actual:':14 ,:13 )

Sixteen e's, five f's, three g's, six h's, nine i's, five n'...een s's, eight t's, three u's, three v's, two w's, four z's.
Autogram? false  (differences: claimed:x:0 z:4 , actual:x:3 z:1 )

Changing the fifth item as shown below gives:

This sentence contains one hundred and seventy-nine letters:...ix u's, seven v's,  four w's, four x's, five y's, and one z.
Autogram? false  (differences: claimed:letters:179 , actual:letters:197 )

Raku

Slightly fragile, especially for non-letter character counts, but good enough for here.

Using Text::Wrap from the ecosystem. Install command: zef install -v git://github.com/jkramer/p6-Text-Wrap.git.

my %nums = :0zero, :1one, :2two, :3three, :4four, :5five, :6six, :7seven, :8eight, :9nine, :10ten, :11eleven,
    :12twelve, :13thirteen, :14fourteen, :15fifteen, :16sixteen, :17seventeen, :18eighteen, :19nineteen,
    :20twenty, :30thirty, :40forty, :50fifty, :60sixty, :70seventy, :80eighty, :90ninety, :100hundred, :1single;

sub whitespace  { $^a.subst(:g, /\s|'.'/, '') }
sub non-letters { $^a.subst(:g, /\W/, '') }

my @tests =
    (&non-letters, "This sentence employs two a's, two c's, two d's, twenty-eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty-five s's, twenty-three t's, six v's, ten w's, two x's, five y's, and one z."),
    (&non-letters, "This sentence employs two a's, two c's, two d's, twenty eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty five s's, twenty three t's, six v's, ten w's, two x's, five y's, and one z."),
    (&whitespace,  "Only the fool would take trouble to verify that his sentence was composed of ten a's, three b's, four c's, four d's, forty-six e's, sixteen f's, four g's, thirteen h's, fifteen i's, two k's, nine l's, four m's, twenty-five n's, twenty-four o's, five p's, sixteen r's, forty-one s's, thirty-seven t's, ten u's, eight v's, eight w's, four x's, eleven y's, twenty-seven commas, twenty-three apostrophes, seven hyphens and, last but not least, a single !"),
    (&non-letters, "This pangram contains four as, one b, two cs, one d, thirty es, six fs, five gs, seven hs, eleven is, one j, one k, two ls, two ms, eighteen ns, fifteen os, two ps, one q, five rs, twenty-seven ss, eighteen ts, two us, seven vs, eight ws, two xs, three ys, & one z."),
    (&non-letters, "This sentence contains one hundred and ninety-seven letters: four a's, one b, three c's, five d's, thirty-four e's, seven f's, one g, six h's, twelve i's, three l's, twenty-six n's, ten o's, ten r's, twenty-nine s's, nineteen t's, six u's, seven v's, four w's, four x's, five y's, and one z."),
    (&non-letters, "Thirteen e's, five f's, two g's, five h's, eight i's, two l's, three n's, six o's, six r's, twenty s's, twelve t's, three u's, four v's, six w's, four x's, two y's."),
    (&whitespace,  "Fifteen e's, seven f's, four g's, six h's, eight i's, four n's, five o's, six r's, eighteen s's, eight t's, four u's, three v's, two w's, three x's."),
    (&non-letters, "Sixteen e's, five f's, three g's, six h's, nine i's, five n's, four o's, six r's, eighteen s's, eight t's, three u's, three v's, two w's, four z's.")
;

use Text::Wrap;

say '=' x 100;

for @tests ->  (&filter, $text) {

    # Original
    say wrap-text :100width, $text;

    say "\nFiltering out " ~ &filter.name ~ ':';

    # Semi-bogus and somewhat fragile names to numbers conversion.
    my $str = $text.lc;
    for %nums.kv -> $word, $number { $str ~~ s:g/ <|w> $word <|w> /$number/ }
    $str ~~ s:g/ (\d)<ws>['and'|'-']<ws>(\d)  /$0 $1/;
    $str ~~ s:g/ <|w>(\d ** 2)<ws>(\d ** 2) <|w> /{ $0 × 100 + $1}/;
    $str ~~ s:g/ ( [\d+<ws>]* \d+ ) /{[+] $0.split: ' '}/;

    # Build a hash of claimed characters.
    my %claim = flat $str.lc.match(:g, /\d+ <:ws> ['comma'|'apostrophe'|'hyphen'|.]/)».split(' ')»[1,0]».pairup;
    for <comma , hyphen - apostrophe '> #`['] -> $word, $symbol { %claim{$symbol} = %claim{$word}:delete if %claim{$word} }
    say "\nClaimed character counts:\n" ~ wrap-text :100width, %claim.sort( ~*.key ).map( { sprintf "%s\(%d)", .key, .value } ).join: ' ';

    # And of the actual character counts.
    my %count = &filter($text).lc.comb.Bag.hash;
    say "\nActual:\n" ~ wrap-text :100width, %count.sort( ~*.key ).map( { sprintf "%s\(%d)", .key, .value } ).join: ' ';

    # And compare them
    say "\nAutogram? " ~
    quietly (so all %count.map: { .value == %claim{.key} }) && (so all %claim.map: { .value == %count{.key} });

    say '=' x 100;
}
Output:
====================================================================================================
This sentence employs two a's, two c's, two d's, twenty-eight e's, five f's, three g's, eight h's,
eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty-five s's,
twenty-three t's, six v's, ten w's, two x's, five y's, and one z.

Filtering out non-letters:

Claimed character counts:
a(2) c(2) d(2) e(28) f(5) g(3) h(8) i(11) l(3) m(2) n(13) o(9) p(2) r(5) s(25) t(23) v(6) w(10) x(2)
y(5) z(1)

Actual:
a(2) c(2) d(2) e(28) f(5) g(3) h(8) i(11) l(3) m(2) n(13) o(9) p(2) r(5) s(25) t(23) v(6) w(10) x(2)
y(5) z(1)

Autogram? True
====================================================================================================
This sentence employs two a's, two c's, two d's, twenty eight e's, five f's, three g's, eight h's,
eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty five s's, twenty
three t's, six v's, ten w's, two x's, five y's, and one z.

Filtering out non-letters:

Claimed character counts:
a(2) c(2) d(2) e(28) f(5) g(3) h(8) i(11) l(3) m(2) n(13) o(9) p(2) r(5) s(25) t(23) v(6) w(10) x(2)
y(5) z(1)

Actual:
a(2) c(2) d(2) e(28) f(5) g(3) h(8) i(11) l(3) m(2) n(13) o(9) p(2) r(5) s(25) t(23) v(6) w(10) x(2)
y(5) z(1)

Autogram? True
====================================================================================================
Only the fool would take trouble to verify that his sentence was composed of ten a's, three b's,
four c's, four d's, forty-six e's, sixteen f's, four g's, thirteen h's, fifteen i's, two k's, nine
l's, four m's, twenty-five n's, twenty-four o's, five p's, sixteen r's, forty-one s's, thirty-seven
t's, ten u's, eight v's, eight w's, four x's, eleven y's, twenty-seven commas, twenty-three
apostrophes, seven hyphens and, last but not least, a single !

Filtering out whitespace:

Claimed character counts:
!(1) '(23) ,(27) -(7) a(10) b(3) c(4) d(4) e(46) f(16) g(4) h(13) i(15) k(2) l(9) m(4) n(25) o(24)
p(5) r(16) s(41) t(37) u(10) v(8) w(8) x(4) y(11)

Actual:
!(1) '(23) ,(27) -(7) a(10) b(3) c(4) d(4) e(46) f(16) g(4) h(13) i(15) k(2) l(9) m(4) n(25) o(24)
p(5) r(16) s(41) t(37) u(10) v(8) w(8) x(4) y(11)

Autogram? True
====================================================================================================
This pangram contains four as, one b, two cs, one d, thirty es, six fs, five gs, seven hs, eleven
is, one j, one k, two ls, two ms, eighteen ns, fifteen os, two ps, one q, five rs, twenty-seven ss,
eighteen ts, two us, seven vs, eight ws, two xs, three ys, & one z.

Filtering out non-letters:

Claimed character counts:
a(4) b(1) c(2) d(1) e(30) f(6) g(5) h(7) i(11) j(1) k(1) l(2) m(2) n(18) o(15) p(2) q(1) r(5) s(27)
t(18) u(2) v(7) w(8) x(2) y(3) z(1)

Actual:
a(4) b(1) c(2) d(1) e(30) f(6) g(5) h(7) i(11) j(1) k(1) l(2) m(2) n(18) o(15) p(2) q(1) r(5) s(27)
t(18) u(2) v(7) w(8) x(2) y(3) z(1)

Autogram? True
====================================================================================================
This sentence contains one hundred and ninety-seven letters: four a's, one b, three c's, five d's,
thirty-four e's, seven f's, one g, six h's, twelve i's, three l's, twenty-six n's, ten o's, ten r's,
twenty-nine s's, nineteen t's, six u's, seven v's, four w's, four x's, five y's, and one z.

Filtering out non-letters:

Claimed character counts:
a(4) b(1) c(3) d(5) e(34) f(7) g(1) h(6) i(12) l(3) n(26) o(10) r(10) s(29) t(19) u(6) v(7) w(4)
x(4) y(5) z(1)

Actual:
a(4) b(1) c(3) d(5) e(34) f(7) g(1) h(6) i(12) l(3) n(26) o(10) r(10) s(29) t(19) u(6) v(7) w(4)
x(4) y(5) z(1)

Autogram? True
====================================================================================================
Thirteen e's, five f's, two g's, five h's, eight i's, two l's, three n's, six o's, six r's, twenty
s's, twelve t's, three u's, four v's, six w's, four x's, two y's.

Filtering out non-letters:

Claimed character counts:
e(13) f(5) g(2) h(5) i(8) l(2) n(3) o(6) r(6) s(20) t(12) u(3) v(4) w(6) x(4) y(2)

Actual:
e(13) f(5) g(2) h(5) i(8) l(2) n(3) o(6) r(6) s(20) t(12) u(3) v(4) w(6) x(4) y(2)

Autogram? True
====================================================================================================
Fifteen e's, seven f's, four g's, six h's, eight i's, four n's, five o's, six r's, eighteen s's,
eight t's, four u's, three v's, two w's, three x's.

Filtering out whitespace:

Claimed character counts:
e(15) f(7) g(4) h(6) i(8) n(4) o(5) r(6) s(18) t(8) u(4) v(3) w(2) x(3)

Actual:
'(14) ,(13) e(15) f(7) g(4) h(6) i(8) n(4) o(5) r(6) s(18) t(8) u(4) v(3) w(2) x(3)

Autogram? False
====================================================================================================
Sixteen e's, five f's, three g's, six h's, nine i's, five n's, four o's, six r's, eighteen s's,
eight t's, three u's, three v's, two w's, four z's.

Filtering out non-letters:

Claimed character counts:
e(16) f(5) g(3) h(6) i(9) n(5) o(4) r(6) s(18) t(8) u(3) v(3) w(2) z(4)

Actual:
e(16) f(5) g(3) h(6) i(9) n(5) o(4) r(6) s(18) t(8) u(3) v(3) w(2) x(3) z(1)

Autogram? False
====================================================================================================

Wren

Library: Wren-str

Frankly, not a bullet-proof solution but good enough to check the required sentences.

import "./str" for Str

var numbers = [
    ["fourteen", "14"],
    ["sixteen", "16"],
    ["seventeen", "17"],
    ["eighteen", "18"],
    ["nineteen", "19"],
    ["sixty", "60"],
    ["seventy", "70"],
    ["eighty", "80"],
    ["ninety", "90"],
    ["one", "1"],
    ["two", "2"],
    ["three", "3"],
    ["four", "4"],
    ["five", "5"],
    ["six", "6"],
    ["seven", "7"],
    ["eight", "8"],
    ["nine", "9"],
    ["ten", "10"],
    ["eleven", "11"],
    ["twelve", "12"],
    ["thirteen", "13"],
    ["fifteen", "15"],
    ["twenty", "20"],
    ["thirty", "30"],
    ["forty", "40"],
    ["fifty", "50"],
    ["single", "1"],
]

var punctuation = [
    ["comma", ","],
    ["hyphen", "-"],
    ["apostrophe", "'"],
    ["exclamation", "!"]
]
var letters = "abcdefghijklmnopqrstuvwxyz"
var symbols = ",-'!"

var autogram = Fn.new { |sentence, ignorePunct|
    System.print("Sentence:\n%(sentence)")
    System.print("Ignore punctuation: %(ignorePunct ? "yes" : "no")")
    var s = Str.lower(sentence)
    // get actual character counts
    var countable = ignorePunct ? letters : letters + symbols
    var map = {}
    for (c in s) {
        if (!countable.contains(c)) continue
        if (map.containsKey(c)) {
            map[c] = map[c] + 1
        } else {
            map[c] = 1
        }
    }
    var keys = map.keys.toList.sort{ |i, j| Str.le(i, j) } // sort into lexicographical order
    var charCounts = keys.map { |k| [k, map[k]] }.join(" ")
    System.print("\nActual character counts:")
    System.print(charCounts)

    var map2 = {}
    for (number in numbers) s = s.replace(number[0], number[1])
    if (!ignorePunct) {
        for (punct in punctuation) s = s.replace(punct[0], punct[1])
    }
    var words = Str.splitNoEmpty(s, " ")
    var i = 0
    var wc = words.count
    while (i < wc - 1) {
        if (Str.allDigits(words[i])) {
            if (Str.allDigits(words[i+1]) && i + 2 < wc) {
                var count = Num.fromString(words[i]) + Num.fromString(words[i+1])
                var char = words[i + 2][0]
                map2[char] = count
                i = i + 3
            } else if (i + 1 < wc) {
                var count = Num.fromString(words[i])
                var char = words[i + 1][0]
                map2[char] = count
                i = i + 2
            }
        } else if (words[i].contains("-")) {
            var split = words[i].split("-")
            if (Str.allDigits(split[0]) && Str.allDigits(split[1]) && i + 1 < wc) {
                var count = Num.fromString(split[0]) + Num.fromString(split[1])
                var char = words[i + 1][0]
                map2[char] = count
                i = i + 2
            }
        } else {
            i = i + 1
        }
    }
    var keys2 = map2.keys.toList.sort{ |i, j| Str.le(i, j) }
    var charCounts2 = keys2.map { |k| [k, map2[k]] }.join(" ")
    System.print("\nPurported character counts:")
    System.print(charCounts2)
    System.print("\nIs autogram? %(charCounts == charCounts2)")
}

var tests = [
    ["This sentence employs two a's, two c's, two d's, twenty-eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty-five s's, twenty-three t's, six v's, ten w's, two x's, five y's, and one z.", true],
    ["This sentence employs two a's, two c's, two d's, twenty eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty five s's, twenty three t's, six v's, ten w's, two x's, five y's, and one z.", true],
    ["Only the fool would take trouble to verify that his sentence was composed of ten a's, three b's, four c's, four d's, forty-six e's, sixteen f's, four g's, thirteen h's, fifteen i's, two k's, nine l's, four m's, twenty-five n's, twenty-four o's, five p's, sixteen r's, forty-one s's, thirty-seven t's, ten u's, eight v's, eight w's, four x's, eleven y's, twenty-seven commas, twenty-three apostrophes, seven hyphens and, last but not least, a single !", false],
    ["This pangram contains four as, one b, two cs, one d, thirty es, six fs, five gs, seven hs, eleven is, one j, one k, two ls, two ms, eighteen ns, fifteen os, two ps, one q, five rs, twenty-seven ss, eighteen ts, two us, seven vs, eight ws, two xs, three ys, & one z.", true],
    ["This sentence contains one hundred and ninety-seven letters: four a's, one b, three c's, five d's, thirty-four e's, seven f's, one g, six h's, twelve i's, three l's, twenty-six n's, ten o's, ten r's, twenty-nine s's, nineteen t's, six u's, seven v's, four w's, four x's, five y's, and one z.", true],
    ["Thirteen e's, five f's, two g's, five h's, eight i's, two l's, three n's, six o's, six r's, twenty s's, twelve t's, three u's, four v's, six w's, four x's, two y's.", true],
    ["Fifteen e's, seven f's, four g's, six h's, eight i's, four n's, five o's, six r's, eighteen s's, eight t's, four u's, three v's, two w's, three x's.", false],
    ["Sixteen e's, five f's, three g's, six h's, nine i's, five n's, four o's, six r's, eighteen s's, eight t's, three u's, three v's, two w's, four z's.", true]
]

for (t in tests) {
    autogram.call(t[0], t[1])
    System.print("=" * 80)
}
Output:
Sentence:
This sentence employs two a's, two c's, two d's, twenty-eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty-five s's, twenty-three t's, six v's, ten w's, two x's, five y's, and one z.
Ignore punctuation: yes

Actual character counts:
[a, 2] [c, 2] [d, 2] [e, 28] [f, 5] [g, 3] [h, 8] [i, 11] [l, 3] [m, 2] [n, 13] [o, 9] [p, 2] [r, 5] [s, 25] [t, 23] [v, 6] [w, 10] [x, 2] [y, 5] [z, 1]

Purported character counts:
[a, 2] [c, 2] [d, 2] [e, 28] [f, 5] [g, 3] [h, 8] [i, 11] [l, 3] [m, 2] [n, 13] [o, 9] [p, 2] [r, 5] [s, 25] [t, 23] [v, 6] [w, 10] [x, 2] [y, 5] [z, 1]

Is autogram? true
================================================================================
Sentence:
This sentence employs two a's, two c's, two d's, twenty eight e's, five f's, three g's, eight h's, eleven i's, three l's, two m's, thirteen n's, nine o's, two p's, five r's, twenty five s's, twenty three t's, six v's, ten w's, two x's, five y's, and one z.
Ignore punctuation: yes

Actual character counts:
[a, 2] [c, 2] [d, 2] [e, 28] [f, 5] [g, 3] [h, 8] [i, 11] [l, 3] [m, 2] [n, 13] [o, 9] [p, 2] [r, 5] [s, 25] [t, 23] [v, 6] [w, 10] [x, 2] [y, 5] [z, 1]

Purported character counts:
[a, 2] [c, 2] [d, 2] [e, 28] [f, 5] [g, 3] [h, 8] [i, 11] [l, 3] [m, 2] [n, 13] [o, 9] [p, 2] [r, 5] [s, 25] [t, 23] [v, 6] [w, 10] [x, 2] [y, 5] [z, 1]

Is autogram? true
================================================================================
Sentence:
Only the fool would take trouble to verify that his sentence was composed of ten a's, three b's, four c's, four d's, forty-six e's, sixteen f's, four g's, thirteen h's, fifteen i's, two k's, nine l's, four m's, twenty-five n's, twenty-four o's, five p's, sixteen r's, forty-one s's, thirty-seven t's, ten u's, eight v's, eight w's, four x's, eleven y's, twenty-seven commas, twenty-three apostrophes, seven hyphens and, last but not least, a single !
Ignore punctuation: no

Actual character counts:
[!, 1] [', 23] [,, 27] [-, 7] [a, 10] [b, 3] [c, 4] [d, 4] [e, 46] [f, 16] [g, 4] [h, 13] [i, 15] [k, 2] [l, 9] [m, 4] [n, 25] [o, 24] [p, 5] [r, 16] [s, 41] [t, 37] [u, 10] [v, 8] [w, 8] [x, 4] [y, 11]

Purported character counts:
[!, 1] [', 23] [,, 27] [-, 7] [a, 10] [b, 3] [c, 4] [d, 4] [e, 46] [f, 16] [g, 4] [h, 13] [i, 15] [k, 2] [l, 9] [m, 4] [n, 25] [o, 24] [p, 5] [r, 16] [s, 41] [t, 37] [u, 10] [v, 8] [w, 8] [x, 4] [y, 11]

Is autogram? true
================================================================================
Sentence:
This pangram contains four as, one b, two cs, one d, thirty es, six fs, five gs, seven hs, eleven is, one j, one k, two ls, two ms, eighteen ns, fifteen os, two ps, one q, five rs, twenty-seven ss, eighteen ts, two us, seven vs, eight ws, two xs, three ys, & one z.
Ignore punctuation: yes

Actual character counts:
[a, 4] [b, 1] [c, 2] [d, 1] [e, 30] [f, 6] [g, 5] [h, 7] [i, 11] [j, 1] [k, 1] [l, 2] [m, 2] [n, 18] [o, 15] [p, 2] [q, 1] [r, 5] [s, 27] [t, 18] [u, 2] [v, 7] [w, 8] [x, 2] [y, 3] [z, 1]

Purported character counts:
[a, 4] [b, 1] [c, 2] [d, 1] [e, 30] [f, 6] [g, 5] [h, 7] [i, 11] [j, 1] [k, 1] [l, 2] [m, 2] [n, 18] [o, 15] [p, 2] [q, 1] [r, 5] [s, 27] [t, 18] [u, 2] [v, 7] [w, 8] [x, 2] [y, 3] [z, 1]

Is autogram? true
================================================================================
Sentence:
This sentence contains one hundred and ninety-seven letters: four a's, one b, three c's, five d's, thirty-four e's, seven f's, one g, six h's, twelve i's, three l's, twenty-six n's, ten o's, ten r's, twenty-nine s's, nineteen t's, six u's, seven v's, four w's, four x's, five y's, and one z.
Ignore punctuation: yes

Actual character counts:
[a, 4] [b, 1] [c, 3] [d, 5] [e, 34] [f, 7] [g, 1] [h, 6] [i, 12] [l, 3] [n, 26] [o, 10] [r, 10] [s, 29] [t, 19] [u, 6] [v, 7] [w, 4] [x, 4] [y, 5] [z, 1]

Purported character counts:
[a, 4] [b, 1] [c, 3] [d, 5] [e, 34] [f, 7] [g, 1] [h, 6] [i, 12] [l, 3] [n, 26] [o, 10] [r, 10] [s, 29] [t, 19] [u, 6] [v, 7] [w, 4] [x, 4] [y, 5] [z, 1]

Is autogram? true
================================================================================
Sentence:
Thirteen e's, five f's, two g's, five h's, eight i's, two l's, three n's, six o's, six r's, twenty s's, twelve t's, three u's, four v's, six w's, four x's, two y's.
Ignore punctuation: yes

Actual character counts:
[e, 13] [f, 5] [g, 2] [h, 5] [i, 8] [l, 2] [n, 3] [o, 6] [r, 6] [s, 20] [t, 12] [u, 3] [v, 4] [w, 6] [x, 4] [y, 2]

Purported character counts:
[e, 13] [f, 5] [g, 2] [h, 5] [i, 8] [l, 2] [n, 3] [o, 6] [r, 6] [s, 20] [t, 12] [u, 3] [v, 4] [w, 6] [x, 4] [y, 2]

Is autogram? true
================================================================================
Sentence:
Fifteen e's, seven f's, four g's, six h's, eight i's, four n's, five o's, six r's, eighteen s's, eight t's, four u's, three v's, two w's, three x's.
Ignore punctuation: no

Actual character counts:
[', 14] [,, 13] [e, 15] [f, 7] [g, 4] [h, 6] [i, 8] [n, 4] [o, 5] [r, 6] [s, 18] [t, 8] [u, 4] [v, 3] [w, 2] [x, 3]

Purported character counts:
[e, 15] [f, 7] [g, 4] [h, 6] [i, 8] [n, 4] [o, 5] [r, 6] [s, 18] [t, 8] [u, 4] [v, 3] [w, 2] [x, 3]

Is autogram? false
================================================================================
Sentence:
Sixteen e's, five f's, three g's, six h's, nine i's, five n's, four o's, six r's, eighteen s's, eight t's, three u's, three v's, two w's, four z's.
Ignore punctuation: yes

Actual character counts:
[e, 16] [f, 5] [g, 3] [h, 6] [i, 9] [n, 5] [o, 4] [r, 6] [s, 18] [t, 8] [u, 3] [v, 3] [w, 2] [x, 3] [z, 1]

Purported character counts:
[e, 16] [f, 5] [g, 3] [h, 6] [i, 9] [n, 5] [o, 4] [r, 6] [s, 18] [t, 8] [u, 3] [v, 3] [w, 2] [z, 4]

Is autogram? false
================================================================================