A ChatGPT Text Chunker


I found I need to upload text over multiple entries to get it all into ChatGPT. Guessing how many chunks to break it into based on the number of tokens is not an easy thing to do. I have created this to help simplify the process.

Just drop in your text, select the chunk size and this will break it up. It is not perfect. It is not using the API, so it is estimating based on the average 4 characters per token. G4 is supposedly 8192 tokens per entry max, G3.5 is 2048. Make sure to select the correct one. I have factored in a margin that will give some breathing room as I see how close this gets to the limits. For the purposes of this script, that should be more than accurate enough.

Leave me a comment if you use it. I’d love to hear your use case!

Here is what is cool about this. I used ChatGPT to actually write the code with some help from Bard. It took a while to get it functional, but it seems to do what was intended now. Let me know if you have issues. My testing says it does a reasonable job.

Leave a Reply

Your email address will not be published. Required fields are marked *