random word generator (from characters)
very unstable and crash-prone
use chatgpt optimized version please i beg of you
i trained it off of some random sentences and a random word generator
examples
- wavereat
- bours
- thersent
- pingle
- obaterea
- ared
- ateas
- sucheryin
- oner
- writha
- candom
- but
- prom
- Error: Command failed: timeout 7 python3 main.py
import random
TEXT = '''If you are visiting this page, you are likely here because you are searching for a random sentence. Sometimes a random word just is not enough, and that is where the random sentence generator comes into play. By inputting the desired number, you can make a list of as many random sentences as you want or need. Producing random sentences can be helpful in a number of different ways.
For writers, a random sentence can help them get their creative juices flowing. Since the topic of the sentence is completely unknown, it forces the writer to be creative when the sentence appears. There are a number of different ways a writer can use the random sentence for creativity. The most common way to use the sentence is to begin a story. Another option is to include it somewhere in the story. A much more difficult challenge is to use it to end a story. In any of these cases, it forces the writer to think creatively since they have no idea what sentence will appear from the tool.
For those writers who have writers' block, this can be an excellent way to take a step to crumbling those walls. By taking the writer away from the subject matter that is causing the block, a random sentence may allow them to see the project they are working on in a different light and perspective. Sometimes all it takes is to get that first sentence down to help break the block.
It can also be successfully used as a daily exercise to get writers to begin writing. Being shown a random sentence and using it to complete a paragraph each day can be an excellent way to begin any writing session.
Random sentences can also spur creativity in other types of projects being done. If you are trying to come up with a new concept, a new idea or a new product, a random sentence may help you find unique qualities you may not have considered. Trying to incorporate the sentence into your project can help you look at it in different and unexpected ways than you would normally on your own.
It can also be a fun way to surprise others. You might choose to share a random sentence on social media just to see what type of reaction it garners from others. it is an unexpected move that might create more conversation than a typical post or tweet.
These are just a few ways that one might use the random sentence generator for their benefit. If you are not sure if it will help in the way you want, the best course of action is to try it and see. Have several random sentences generated and you will soon be able to see if they can help with your project.
Our goal is to make this tool as useful as possible. For anyone who uses this tool and comes up with a way we can improve it, we would love to know your thoughts. Please contact us so we can consider adding your ideas to make the random sentence generator the best it can be.
He was the type of guy who liked Christmas lights on his house in the middle of July.
Having no hair made him look even hairier.
Someone I know recently combined Maple Syrup and buttered Popcorn thinking it would taste like caramel popcorn. It didn’t and they don’t recommend anyone else do it either.
When transplanting seedlings, candied teapots will make the task easier.
He was sure the Devil created red sparkly glitter.
The estate agent quickly marked out his territory on the dance floor.
Imagine his surprise when he discovered that the safe was full of pudding.
Potato wedges probably are not best for relationships.
He looked behind the door and did not like what he saw.
His thought process was on so many levels that he gave himself a phobia of heights.
When motorists sped in and out of traffic, all she could think of was those in need of a transplant.
I am never at home on Sundays.
Please put on these earmuffs because I can not you hear.
it is a skateboarding penguin with a sunhat!
The best key lime pie is still up for debate.
Instead of a bachelorette party
There are not enough towels in the world to stop the sewage flowing from his mouth.
Malls are great places to shop; I can find everything I need under one roof.
The rusty nail stood erect, angled at a 45-degree angle, just waiting for the perfect barefoot to come along.
I know many children ask for a pony, but I wanted a bicycle with rockets strapped to it.
She could not decide of the glass was half empty or half full so she drank it.
He quietly entered the museum as the super bowl started.
Karen believed all traffic laws should be obeyed by all except herself.
Thirty years later, she still thought it was okay to put the toilet paper roll under rather than over.
The anaconda was the greatest criminal mastermind in this part of the neighborhood.
Pair your designer cowboy hat with scuba gear for a memorable occasion.
This is a Japanese doll.
There were a lot of paintings of monkeys waving bamboo sticks in the gallery.
He liked to play with words in the bathtub.
his seven layer cake only had six layers.
When he encountered maize for the first time, he thought it incredibly corny.
In the end, he realized he could see sound and hear words.
I would rather be a bird than a fish.
Sometimes I stare at a door or a wall and I wonder what is this reality, why am I alive, and what is this all about?
Honestly, I did not care much for the first season, so I did not bother with the second.
He decided to live his life by the big beats manifesto.
Happiness can be found in the depths of chocolate pudding.
There can never be too many cherries on an ice cream sundae.
We will not allow you to bring your pet armadillo along.
I always dreamed about being stranded on a desert island until it actually happened.
I come from a tribe of head hunters, so I will never need a shrink.
At that moment she realized she had a sixth sense.
Car safety systems have come a long way, but he was out to prove they could be outsmarted.
He waited for the stop sign to turn to a go sign.
The sight of his goatee made me want to run and hide under my sister in law s bed.
As he entered the church he could hear the soft voice of someone whispering into a cell phone.
The hawk didn’t understand why the ground squirrels didn’t want to be his friend.
As you consider all the possible ways to improve yourself and the world, you notice John Travolta seems fairly unhappy.
He wondered if it could be called a beach if there was no sand.
Chocolate covered crickets were his favorite snack.
unfortunate
fine
pour
frighten
recovery
beg
user
impulse
age
gap
loot
fee
cutting
gain
fire
election
eaux
grounds
hostage
recommend
tire
thumb
deter
wave
stuff
rock
kneel
colorful
earthquake
joke
rally
dead
coffee
X ray
reception
confidence
inspire
egg
arrange
bulb
likely
trade
cellar
concentration
occupation
vacuum
compartment
camp
jewel
satellite
adventure
labour
blank
troop
certain
adjust
parade
orthodox
law
democratic
charity
archive
meaning
read
bin
temptation
regard
sofa
tiger
corner
live
relieve
stick
laser
Venus
brush
rehearsal
quit
negative
mutation
complex
siege
socialist
speculate
method
hurt
point
society
tendency
government
sweater
sulphur
teach
bind
fat
activity
range
suffering
braid
hunter
'''
starts = []
#ends = []
prevprevs = []
prevs = []
nexts = []
lengths = []
sentences = TEXT.split(".")
for sentence in sentences:
words = sentence.split(" ")
if "" in words:
words.remove("")
for i in range(len(words)):
word = words[i]
blacklist = ["\n", " "]
for bl in blacklist:
if bl in word:
tmp = word.split(bl)
while True:
try:
tmp.remove("")
except:
break
words.pop(i)
for j in tmp:
words.append(j)
for i in range(len(words)):
word = words[i]
try:
word = random.choice(word.split("\n"))
except:
pass
blacklist = ["'", "-", ",", "?", "!",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
for bl in blacklist:
if bl in word:
word = word.replace(bl, "")
lengths.append(len(word)-1)
for i in range(len(word)):
if i == 0:
starts.append(word[i])
#if i == len(word)-1:
# ends.append(word[i])
if i > 1:
prevprevs.append(word[i-2].lower())
prevs.append(word[i-1].lower())
nexts.append(word[i].lower())
#print(starts)
word = random.choice(starts)
length = random.choice(lengths)
#length = 8
do = True
done = []
while do:
tmp = random.randint(0, len(prevs)-1)
while tmp in done:
tmp = random.randint(0, len(prevs)-1)
done.append(tmp)
do = prevprevs[tmp] != word[0]
word += prevs[tmp]
do = True
done = []
while do:
tmp = random.randint(0, len(prevs)-1)
while tmp in done:
tmp = random.randint(0, len(prevs)-1)
done.append(tmp)
do = prevs[tmp] != word[-1]
if prevprevs[tmp] != word[0]:
do = True
word += nexts[tmp]
for i in range(length):
do = True
done = []
while do:
tmp = random.randint(0, len(prevs)-1)
while tmp in done:
tmp = random.randint(0, len(prevs)-1)
done.append(tmp)
do = prevs[tmp] != word[-1]
if prevprevs[tmp] != word[-2]:
do = True
#word += prevs[tmp]
word += nexts[tmp]
print(word)
chatgpt optimized version
import random
import re
TEXT = '''If you are visiting this page, you are likely here because you are searching for a random sentence. Sometimes a random word just is not enough, and that is where the random sentence generator comes into play. By inputting the desired number, you can make a list of as many random sentences as you want or need. Producing random sentences can be helpful in a number of different ways.
For writers, a random sentence can help them get their creative juices flowing. Since the topic of the sentence is completely unknown, it forces the writer to be creative when the sentence appears. There are a number of different ways a writer can use the random sentence for creativity. The most common way to use the sentence is to begin a story. Another option is to include it somewhere in the story. A much more difficult challenge is to use it to end a story. In any of these cases, it forces the writer to think creatively since they have no idea what sentence will appear from the tool.
For those writers who have writers' block, this can be an excellent way to take a step to crumbling those walls. By taking the writer away from the subject matter that is causing the block, a random sentence may allow them to see the project they are working on in a different light and perspective. Sometimes all it takes is to get that first sentence down to help break the block.
It can also be successfully used as a daily exercise to get writers to begin writing. Being shown a random sentence and using it to complete a paragraph each day can be an excellent way to begin any writing session.
Random sentences can also spur creativity in other types of projects being done. If you are trying to come up with a new concept, a new idea or a new product, a random sentence may help you find unique qualities you may not have considered. Trying to incorporate the sentence into your project can help you look at it in different and unexpected ways than you would normally on your own.
It can also be a fun way to surprise others. You might choose to share a random sentence on social media just to see what type of reaction it garners from others. it is an unexpected move that might create more conversation than a typical post or tweet.
These are just a few ways that one might use the random sentence generator for their benefit. If you are not sure if it will help in the way you want, the best course of action is to try it and see. Have several random sentences generated and you will soon be able to see if they can help with your project.
Our goal is to make this tool as useful as possible. For anyone who uses this tool and comes up with a way we can improve it, we would love to know your thoughts. Please contact us so we can consider adding your ideas to make the random sentence generator the best it can be.
He was the type of guy who liked Christmas lights on his house in the middle of July.
Having no hair made him look even hairier.
Someone I know recently combined Maple Syrup and buttered Popcorn thinking it would taste like caramel popcorn. It didn’t and they don’t recommend anyone else do it either.
When transplanting seedlings, candied teapots will make the task easier.
He was sure the Devil created red sparkly glitter.
The estate agent quickly marked out his territory on the dance floor.
Imagine his surprise when he discovered that the safe was full of pudding.
Potato wedges probably are not best for relationships.
He looked behind the door and did not like what he saw.
His thought process was on so many levels that he gave himself a phobia of heights.
When motorists sped in and out of traffic, all she could think of was those in need of a transplant.
I am never at home on Sundays.
Please put on these earmuffs because I can not you hear.
it is a skateboarding penguin with a sunhat!
The best key lime pie is still up for debate.
Instead of a bachelorette party
There are not enough towels in the world to stop the sewage flowing from his mouth.
Malls are great places to shop; I can find everything I need under one roof.
The rusty nail stood erect, angled at a 45-degree angle, just waiting for the perfect barefoot to come along.
I know many children ask for a pony, but I wanted a bicycle with rockets strapped to it.
She could not decide of the glass was half empty or half full so she drank it.
He quietly entered the museum as the super bowl started.
Karen believed all traffic laws should be obeyed by all except herself.
Thirty years later, she still thought it was okay to put the toilet paper roll under rather than over.
The anaconda was the greatest criminal mastermind in this part of the neighborhood.
Pair your designer cowboy hat with scuba gear for a memorable occasion.
This is a Japanese doll.
There were a lot of paintings of monkeys waving bamboo sticks in the gallery.
He liked to play with words in the bathtub.
his seven layer cake only had six layers.
When he encountered maize for the first time, he thought it incredibly corny.
In the end, he realized he could see sound and hear words.
I would rather be a bird than a fish.
Sometimes I stare at a door or a wall and I wonder what is this reality, why am I alive, and what is this all about?
Honestly, I did not care much for the first season, so I did not bother with the second.
He decided to live his life by the big beats manifesto.
Happiness can be found in the depths of chocolate pudding.
There can never be too many cherries on an ice cream sundae.
We will not allow you to bring your pet armadillo along.
I always dreamed about being stranded on a desert island until it actually happened.
I come from a tribe of head hunters, so I will never need a shrink.
At that moment she realized she had a sixth sense.
Car safety systems have come a long way, but he was out to prove they could be outsmarted.
He waited for the stop sign to turn to a go sign.
The sight of his goatee made me want to run and hide under my sister in law s bed.
As he entered the church he could hear the soft voice of someone whispering into a cell phone.
The hawk didn’t understand why the ground squirrels didn’t want to be his friend.
As you consider all the possible ways to improve yourself and the world, you notice John Travolta seems fairly unhappy.
He wondered if it could be called a beach if there was no sand.
Chocolate covered crickets were his favorite snack.
unfortunate
fine
pour
frighten
recovery
beg
user
impulse
age
gap
loot
fee
cutting
gain
fire
election
eaux
grounds
hostage
recommend
tire
thumb
deter
wave
stuff
rock
kneel
colorful
earthquake
joke
rally
dead
coffee
X ray
reception
confidence
inspire
egg
arrange
bulb
likely
trade
cellar
concentration
occupation
vacuum
compartment
camp
jewel
satellite
Sleep deprivation causes all sorts of challenges and problems. When one doesn’t get enough sleep one’s mind doesn’t work clearly. Studies have shown that after staying awake for 24 hours one’s ability to do simple math is greatly impaired. Driving tired has been shown to be as bad as driving drunk. Moods change, depression, anxiety, and mania can be induced by lack of sleep. As much as people try to do without enough sleep it is a wonder more crazy things don’t happen in this world.
All he wanted was a candy bar. It didn't seem like a difficult request to comprehend, but the clerk remained frozen and didn't seem to want to honor the request. It might have had something to do with the gun pointed at his face.
He had done everything right. There had been no mistakes throughout the entire process. It had been perfection and he knew it without a doubt, but the results still stared back at him with the fact that he had lost.
Stranded. Yes, she was now the first person ever to land on Venus, but that was of little consequence. Her name would be read by millions in school as the first to land here, but that celebrity would never actually be seen by her. She looked at the control panel and knew there was nothing that would ever get it back into working order. She was the first and it was not clear this would also be her last.
It was a simple tip of the hat. Grace didn't think that anyone else besides her had even noticed it. It wasn't anything that the average person would notice, let alone remember at the end of the day. That's why it seemed so unbelievable that this little gesture would ultimately change the course of the world.
''' # Replace this with your original text
# Data storage
starts = []
prevprevs = []
prevs = []
nexts = []
lengths = []
# Function to clean words
def clean_word(word):
return re.sub(r"[^\w]", "", word).lower()
# Preprocess sentences
sentences = TEXT.split(".")
for sentence in sentences:
words = [clean_word(word) for word in sentence.split() if clean_word(word)]
for i, word in enumerate(words):
lengths.append(len(word))
for j in range(len(word)):
char = word[j]
if j == 0:
starts.append(char)
if j > 1:
prevprevs.append(word[j-2])
prevs.append(word[j-1])
nexts.append(char)
# Generate a random word
# Generate a random word
def generate_word(length=8):
"""Generates a random word of the specified length using character relationships."""
if not starts:
raise ValueError("No data to generate a word. Please provide a valid input text.")
word = random.choice(starts) # Start with a random starting character
# Step 1: Use `prevs` to extend the word
while len(word) < 2:
idx = random.randint(0, len(prevs)-1)
if prevprevs[idx] == word[0]:
word += prevs[idx]
break # Stop after one extension
# Step 2: Use `nexts` to extend the word
if len(word) == 2:
for _ in range(100): # Retry up to 100 times to find a match
idx = random.randint(0, len(nexts)-1)
if prevprevs[idx] == word[0] and prevs[idx] == word[1]:
word += nexts[idx] # Extend to the left
break
# Step 3: Add remaining characters to reach the desired length
while len(word) < length:
for _ in range(100): # Retry up to 100 times to find a match
idx = random.randint(0, len(prevs)-1)
if prevs[idx] == word[-1] and (len(word) < 2 or prevprevs[idx] == word[-2]):
word += nexts[idx]
break
return word
for _ in range(10):
#random_word = generate_word(random.randint(4, 8))
random_word = generate_word(random.choice(lengths))
print(random_word)