Count generated words

Hi there,

I’m using ChatGPT on my app and I would like to count the total words generated each time and put add it to the user. For example if one prompt gives the user 200 words, this amount will be added to a field.

Is this possible?

The easier way is is You can split the prompt by space and it will return a list and count the item’s

Thanks for your reply.

How can I split the prompt? Right now it returns a value from a input. Is it “:split by” I should use?

yes, it will ask you the delimeter to choose spliting, use just a space, and then it will return a list, just count it you get the number of word. also do test it with google that your gettign correct value.

and do consider, you will be also counting the words like, it, the, that

Hmm, and there is no other solution? Looks pretty awful when it’s a decimal after each words…

just use cielling or floor to get rid of decimal

But floor and cieling only works for numbers, right? Can’t find that operator…

can you come to a short call i may be able to understand you better and can help you.

I though you just wanted the count of words?..

So it won’t look like anything (count is just a number).

Or is that not what you’re trying to do?

yes, sir, he is trying to do something like it, but he doesn’t want the decimal part, i don’t know why he is saying that, count will always give a whole number.

maybe I am missing something.

I think he’s confused about what you suggested…

but @brandboosters just to clarify…

Take your input text and use :split by and split by a space to get the list of words.

Then use :count to get the number of words in the list.

That will return a number (and it cant possibly be a decimal)

1 Like

Yes I did that. However, when I use the “:split by” followed by a space, the text generated gets decimal after each word. Like “hey, my, name, is,”. Sorry for poor explanation.

However, when I use the “:split by” followed by a space, the text generated gets decimal after each word. Like “hey, my, name, is,”.

No, it doesn’t… it gets converted into a list of words - if you display it somewhere without formatting it some other way then, by default, Bubble uses a comma delimiter (not decimal) - but why would you be displaying the list of words?

All you need is the count of that list.

It’s pretty hard to explain but basically, the workflow takes the prompt from a pre-filled input and sets that text as a state.

Hey, I can spare a few minutes on your app, to walk you through it. If you like :smiley:

Yes I understand what you’re trying to do…

I just don’t understand where you’re having trouble implanting the solution that’s been explained in this thread.

This topic was automatically closed after 70 days. New replies are no longer allowed.