Urban75 Home About Offline BrixtonBuzz Contact

random answer/sayings generator

lolo

Well-Known Member
this is probably v easy but i have no idea, i am after finding some sort of app for a website that generates random sentences from say a beginning, middle and end of sentences that are loaded into it - any ideas? thanks
 
Not what you are after but just got:

Nobody knows why a box angrily destroyed a flaming shampoo bottle. :D
 
That link is fun, I hope to use this one day:

Sometimes, the fox nervously cleaned a screaming chair.
 
The box regularly destroyed a screaming book.

This could be useful for opening lines. :hmm:
 
this is probably v easy but i have no idea, i am after finding some sort of app for a website that generates random sentences from say a beginning, middle and end of sentences that are loaded into it - any ideas? thanks


Someone beat me to it, but one solution is to use markov chains.

Put simply you analyse the input and assign probabilities to each word/punctuation that govern what the next word or punctuation item will be.

So if you stuck in "hello my head is my weapon, oh my." the word 'my' has a chance of being followed by 'head', 'weapon or '.' Each is equally likely so is assigned a probability of 33%.

For longer texts you end up with a massive set of data. You pick a random starting word (from the words that can possibly start sentences) and each word is followed by another picked at random from the possibilities.

I implemented on once with the idea of scanning the boards for all the posts by a given poster then spitting back out random posts in their style :D Never finished it though.
 
It's super easy in java

Code:
interface Word
void addFollowingWord(String word); //add to list of words
string getNextWord(); //select a random word from all the posibilities
 
interface WordFactory
Word getWord(); //store all the words in one place, creating new ones as needed
 
interface DocBuilder
void addWord(Word word);//add the word and correct whitespace.
String getDoc();//spit out the whole doc.

that's it. To use it.

Code:
//analyse document
currentWord =WordFactory.getWord("<START>"); //this means it will always start with a known starting word
for (String s: document){ //you can use string tokenizer for this
currentWord.addNextWord(s):
currentWord = WordFactory.getWord(s);
}
//generate document
currentWord =WordFactory.getWord("<START>");
while (i<generationLength){
currentWord = currentWord.getNextWord();
DocBuilder.addWord(currentWord);
}
// do something with DocBuilder.getDoc
 
It's super easy in java

Code:
interface Word
void addFollowingWord(String word); //add to list of words
string getNextWord(); //select a random word from all the posibilities
 
interface WordFactory
Word getWord(); //store all the words in one place, creating new ones as needed
 
interface DocBuilder
void addWord(Word word);//add the word and correct whitespace.
String getDoc();//spit out the whole doc.

that's it. To use it.

Code:
//analyse document
currentWord =WordFactory.getWord("<START>"); //this means it will always start with a known starting word
for (String s: document){ //you can use string tokenizer for this
currentWord.addNextWord(s):
currentWord = WordFactory.getWord(s);
}
//generate document
currentWord =WordFactory.getWord("<START>");
while (i<generationLength){
currentWord = currentWord.getNextWord();
DocBuilder.addWord(currentWord);
}
// do something with DocBuilder.getDoc


Witch! Burn her!!
 
" The Markov property states that the conditional probability distribution for the system at the next step (and in fact at all future steps) depends only on the current state of the system, and not additionally on the state of the system at previous steps."

"The changes of state of the system are called transitions, and the probabilities associated with various state-changes are called transition probabilities. The set of all states and transition probabilities completely characterizes a Markov chain. By convention, we assume all possible states and transitions have been included in the definition of the processes, so there is always a next state and the process goes on forever."

Basically, you've got a word. Using that word you randomly choose the next word using a set of probabilities. The set of probabilities is generated when you consume some source document.

That's what that pseudo code does (note I didn't implement the interfaces)
 
I implemented on once with the idea of scanning the boards for all the posts by a given poster then spitting back out random posts in their style :D Never finished it though.
I remembered precisely because someone did that for another forum I go on, and the results were uncanny, gibberish in a completely recognisable style!
 
Capital
A Critique of money, equal to be bought and by means of being so that they are epoch-making that, or at another commodity A, if the subdivisions, a permanent right for production, or to the same time that part of definite organisation of production consumed means follows, 000 people and of their own. Since the sub-division of another, except the Professor. ” who grew to deal with labour-power was again, since in order to which in the instruments of 1848-9 also scattered handicrafts in his vital power which every revival; but that displaces. In agriculture increased productiveness in 1864, no heart of economic forms however, with it from 1770 the labourers, Mr. m. Nevertheless, a necessary result is evident that are exceptional legislation above their lash is already in co-operation in Scotland areas as a minimum limit to claim to abstract human labour borne fruit.. Of cities and one word of the miners themselves with the two extremes – money. And how to penetrate. g. Having once, the same result absurd conclusion, and lackering works under slavery; 3. The currency reflects the confused that hedge in the workman must continue to submit to the shape of development, a –( necessary labour on the Act, we should be a labour-giver), instead of capitalist, and the means of agricultural labourers directly social form he will be said to the labour-time being expenditure of the “Essay on their own wants. Hence, 000, who sells it may be spun, to their landlords under 12 hours is work, in Aargau in Manchester manufacturer, and fro a settled plan, &c. 1s. ” To express the substitution of the American journals. It manifests itself, from infants. That which, the sources and men in it had been the conversion of the same way alters its owner for only acts exists only a greater or of it is either distinct acts only for a law of facts that that. The accumulation by the phenomenal form of ban, and accumulation of the less is stuck on, ” the successive steps into the production of sale. In contradistinction therefore, develops, whether payments concentrated in London, the colliers’ wives

Not bad for a first go!

Needs some word around things like quotes, brackets and numbers, but other than that it's working well.

23: And Abram drove them with them from the camel. 24: 17: And he begat sons of heaven from the LORD God went into the trees that the sister of the field, and Pharez, which went in Padan-aram, and her pitcher upon him; Seba, and begat Cainan eight hundred sixty and they rebelled. 20: 17: 29: come ye shall not die, Can we, as much, Jacob said unto them on still toward the serpent, and slew Hamor and Hamul. 3: 32: And the earth. 2: 6: 21: 10: And GOD, and shew kindness which his master's son with him Rachel had conceived, I can carry down without number the earth, 14: These were a name of a surety she went forth; and thy daughters will come and the face of the land will I have brought him, and nine hundred and worship, and see thee of the seven years, My wrong be? 42: And Saul died, and a very ill favoured and restored; and the wells which is. 37: 21: 4: and Lot, and Laban gathered up from the brother, put the flood. 35: And with Sarah he was with me come to see the waters were nine hundred and embraced them. 31: 1: 4: and there was a well which I pray you, I know not he restored unto the excellency of the angels to till they left shall all the fountain of the pit was forty days of fowl of his son's son: 18: 10: Now Israel said unto the same night. 18: 25: And Cain slew him, and thy salvation, behold, and there an hundred sixty and said unto Israel. 38: And he said, and his camels, and the day thy bracelets, and every thing, I will go thou restore thee shall be so the vine was Keturah. 21: 6: 11: 23: I am I have made savoury meat, and he made him before him into his name was the flock of half a son; and the morning that were made it was with bread and it was destroyed Sodom were stopped them, and ye shall come thou not when she bare the river seven and he said, and the other: It is in the fowl multiply thee money. 30: And Rachel; and ten asses, also went forth abundantly in the deep. 35: And Pharaoh gave them; 32: 18: and bare unto him without. 38: 17: And Reuben returned that was good things
 
good old ike

They have to the heritage of Zion. Today. This will come over communization and half prophetic years. But, p. Beatles song, without are working within his total Rule, or the One whose deadly wound was a thousand American Communists. " In the chance that number 666 of the HE IS A true Illuminati protocols -- UNPARDONABLE.

What is calling for a charmer, Benjamin Franklin, he would be so has no nursery rhyme or 1789 8. Nor does the ideas of the proud, which we ask where some instances, Astrology, Romans the "Family" was called a third, to seek even United States, neither on the sacred no Catholic and magazines. " as a snare unto the water, it was the warning from the creation of the true purpose of Canon Law that the Lord was flashing Masonic Report, so that enormous empire.

What Is this Luciferian Government, according to be the one Baal" or Enlightened, "There is a male, let him that it with all the would sound more astonishing facts about how quickly folks will vanish the religion and the transgressions, fire that serveth God has been made an unwanted baby, shewing himself to have the Baphomet was the world which he is that will learn to receive a few Ame- rica's most popular than during the image of a similar but because God, was obvious: "But I should be positive
 
Ok, everyone else has lost interest, but here's the code.

It's a java jar file containing source code and binaries. This means you can run it from the command line and also examine how it works.

usage (You'll need to rename it to markov.jar for this to work):

Code:
java -jar markov.jar <filename> <output length>
example: java -jar markov.jar /tmp/file.txt 100
 

Attachments

  • markov.zip
    7.5 KB · Views: 1
Views:0

:D :facepalm:

It really does work. Honest!

What aileth thee of production once, 28% no Catholic Church, as do not surely die: And say, therefore, much centralization of money changes with me. How then unite himself as a box and with Isaac, and shoemakers, in the umbilical cord that it is only small bedroom often compared with Susan Atkins testifying to the better made up upon it must be had entered., they fall in the Lord was himself about the Birth of exceeding the preparation, the simultaneousness
 
Back
Top Bottom