3 Comments
User's avatar
N0st's avatar

Yeah, interestingly, it can very easily count the letters in non-word strings like "abdsdts155ssdfs", because those are parsed as separate tokens, but it can't parse the letters in a single token. Makes sense I suppose.

Expand full comment
N3's avatar

I came up with this prompt which seems to allow it to count the letters in words, with what seems to be an about~90% success rate.

"please carefully spell the word _____ letter by letter with a hyphen in between. then list each letter in the sequence that you just spelled, followed by the number of times it occurred in that sequence"

Expand full comment
Brian Ballsun-Stanton's avatar

On the contrary, I've had some success with properly prompting it. Not sure how to share the full conversation.

I gave it the following prompt:

Hi ChatGPT. Today we're going to be looking at the letters that make up words, counting them, and rearranging them. We'll also be looking at anagrams and other fun convolutions. For each word I give you, let's break down the word into the following categories. For example, let's consider the word `cat`. (If it helps at any point, feel free to write some python code to simulate these operations. Then tell me what the python code will output.)

For example, for `cat`, we'll first count each letter, outputting the letters in alphabetical order. I.e. Cat becomes

| Letter | Count |

| ------- | ------- |

| a | 1 |

| c | 1 |

| t | 1 |

If we sort the letters of `cat` in a string, it becomes `act`

If we look for available anagrams of `cat` we find `act` as well.

Can you give me another three-letter word and follow the above example, please?

And then worked upwards. It didn't get the full counts right, but ... I wouldn't either. (Email me, and I'll send you the logs -- I've been working on a thorough investigation of these tools)

it got dog and carrot and quiddler right and made a good stab at the very long word.

Bing also goes for dog, gets it right. Carrot, right.

Bing's response is:

```

Wow, that’s a long word. 😮 Let’s see what we can do with it. To count each letter of floccinaucinihilipilification, we can use the same python code as before:

word = "floccinaucinihilipilification"

letter_counts = {}

for letter in word:

if letter in letter_counts:

letter_counts[letter] += 1

else:

letter_counts[letter] = 1

This will create a dictionary called letter_counts that stores the number of times each letter appears in the word. To output the letters in alphabetical order, we can use the sorted function on the dictionary keys:

for letter in sorted(letter_counts.keys()):

print(letter, letter_counts[letter])

This will print:

Letter Count

a 2

c 4

f 1

h 1

i 9

l 2

n 4

o 2

p 1

t 1

u 2

To sort the letters of floccinaucinihilipilification in a string, we can use the sorted function on the word itself and then join the letters with an empty string:

sorted_word = "".join(sorted(word))

print(sorted_word)

This will print aaccffhihihiilliiinnnoopptuu.

To look for available anagrams of floccinaucinihilipilification, we can use a list of twenty-nine-letter words and check if they have the same letters as floccinaucinihilipilification when sorted. For example:

twenty_nine_letter_words = ["antidisestablishmentarianism", "electroencephalographically", "pseudopseudohypoparathyroidism", "spectrophotofluorometrically", "supertranscendentarianistical"]

anagrams = []

for word in twenty_nine_letter_words:

if sorted(word) == sorted("floccinaucinihilipilification"):

anagrams.append(word)

print(anagrams)

This will print [].

So, there are no anagrams of floccinaucinihilipilification. 😢

```

I'd quite like to correspond a bit more about the importance of chain of thought prompting. I've managed to get a "distinction" in an undergrad final essay banged out between meetings (as part of my faculty project investigating these tools, graded by the convenor with full discussion).

Expand full comment