Skip to main content
Question

How to separate text based on word count or character count

  • February 12, 2023
  • 4 replies
  • 2817 views

arimeisel

I want to be able to give zapier a large amount of text and have it break it down into 4000 word chunks, there doesn’t seem to be a way to split by word count

Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Troy Tessalone
Forum|alt.badge.img+14
  • Zapier Expert
  • 30942 replies
  • February 12, 2023

Hi @arimeisel

Good question.

Splitting by # of words VS splitting by # of characters are different executions.

Try using Formatter > Text > Truncate if you want to split based on characters.

Otherwise a Code step can be used.


arimeisel
  • Author
  • New
  • 1 reply
  • February 12, 2023

Either would work for me but I don’t want to just truncate. I need all the individual sections. What would the code be for the code step?


Troy Tessalone
Forum|alt.badge.img+14
  • Zapier Expert
  • 30942 replies
  • February 12, 2023

@arimeisel 

You’ll get very different results if splitting based on words vs splitting based on characters.

Splitting based on characters could split in the middle of a word.

Try asking ChatGPT for the code to use: https://chat.openai.com


shalgrim
Forum|alt.badge.img+8
  • Zapier Staff
  • 406 replies
  • February 24, 2023

Do you mean you want 4000 different chunks regardless of how many words there are? So, for example, 8000 words would generate 4000 two-word chunks and so on?