How To Generate Random Sentence Taking Words From Arrays

Nov 14, 2010

I'm trying to create a program that produces random sentences as output. With five arrays of strings, one each for nouns, adjectives, verbs, prepositions, and articles. Each array should hold several words for that part of speech. Like, the Articles array could hold the strings "the" and "a"; the Nouns array could hold "Martian", "baby", "skunk","computer" and "mosquito"; the Prepositions array could hold "around", "through", "under", "over", and "by"; and so on.

It's supposed to generate sentences by randomly choosing eight words (randomly generating eight array indices) from these arrays, always constructing sentences by using the parts of speech in the following order: article, adjective, noun, verb, preposition, article, adjective, noun. Also, the code should be properly modularized so that the code to generate each part of speech is not repeated.

View 3 Replies


ADVERTISEMENT

Generate Random Sentence In Label1?

Mar 8, 2011

I have a code that can generate from letter a to z

here it is

Private Sub GenerateRandomNumbers()
Dim randomObjectName As New Random
randomObjectName.Next(97, 122)

[Code]....

The problem is I'm expecting that the output will be the dim of the letter.

for example the random generated letter is 'a' the output in label1 will be "hi?"

View 7 Replies

Generate Only 10 Random Words From Listbox1 To Listbox2?

Mar 25, 2010

im using visual studio 2005 and i want to generate 10 random words from listbox1 to listbox2.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim readerVar As IO.StreamReader

[Code].....

View 11 Replies

Extract Certain Words From A Sentence?

Jan 18, 2010

how can I extract a certain words from a sentence input by user. For example, when a user enters "Jones born in 1965", the program will extract the words 'Jones, born, 1965' while eliminating the word 'in'.

View 2 Replies

Extracting Words From A Sentence

Jun 22, 2010

I want to extract certain words from a sentence input by the user. For e.g., the user enters "Jones born in 1967" and the program will extract the words 'Jones, born and 1967' but will not extract the word 'in' and will print the extracted words out.

View 19 Replies

Replace Words In A Sentence?

May 14, 2012

I am trying to replace words in a sentence.

Code:
Public Function convert(ByVal sentence As String) As String
Dim conv As String = sentence
conv = Replace(conv, "I am ", "you are")
conv = Replace(conv, "I'm", "you are")

[code]....

This works to some degree but a word like "Mommy" becomes "Momyour". Or "mean" becomes "youan" How can I do this with full words only? I've tried putting spaces before and after within the quotes, but then any of the words that need changed at the beginning of a paragraph, don't change because there is no space at the beginning.

View 1 Replies

Creating Objects - Words And Sentence Class

Jun 21, 2010

I'm using VB.NET (visual studio) to create a chatbox (a program that mimics a human and has a text converstion with you). Two of my main classes are a word class and a sentence class. The sentence object is basically going to be a linked list of words objects. As the program executes, many word objects will be instantiated, and so will many sentence objects. But, each class (used to create the object) has several constants, procedures, and functions defined.

For each object instantiated, are new copies of the constants, procedures, and functions created in memory? Or, is only one copy of the constants and procedures created? Since many many objects will be created during program execution (each word of a sentence will be an object), that if the constants/procedures/functions are defined in memory again and again, that I'll run out of memory. What is the best way to structure my program so that the objects created contain only the variable data, and the constants/procedures/functions are defined only once?

View 7 Replies

Random Sentence Will Appear In Textbox

Feb 6, 2010

I am trying to make a program that whenever you click a button, a random sentence will appear in the textbox.

View 3 Replies

Taking Data From Arrays And Using It

Oct 13, 2009

But like always I have a question. I need to take the data that I have stored in arrays and use it. But how do I do that? What I need is to take numbers stored in the arrays and add and subtract them and put them in the appropriate array , like this:

[Code]...

View 1 Replies

Code Generate A Random Number / How To Make It 'TRULY' Random

May 29, 2011

I am trying to make a texas hold em game and it is of the utmost importance that my code generate a random number. But using a random number function that I always end up with a lot of the same numbers over and over again. Any ideas on how to make it "TRULY" random? [code]

View 3 Replies

VS 2010 Create A Program That When Click A Button It Shows A Sentence (took It From A List) Random?

Feb 13, 2011

I need to create a program that when I click a button it shows a sentence (took it from a list) random. But after it have to delete the sentence from the list 'cause we dont want to read it again I don't know so much about VB so I'd like some help!

View 25 Replies

Progammatically Generate Executable Files After Taking Custom Parameters From The User?

Apr 22, 2009

I would need samples/hints on how to progammatically generate executable files after taking custom parameters from the user.I have looked into codedom and I almost got it to work except for the little fact that my application launches the console too and it's meant to be a simple windows form.

View 1 Replies

Generate A Combination Of Words?

Apr 12, 2010

I would like to generate a combination of words. For example if I had the following list:

{cat, dog, horse, ape, hen, mouse}
then the result would be n(n-1)/2
cat dog horse ape hen mouse
(cat dog) (dog horse) (horse ape) (ape hen) (hen mouse)
(cat dog horse) (dog horse ape) (horse ape hen) etc

View 2 Replies

Combinations :: Generate All Possible Words On File?

Dec 10, 2011

Example :

If a got word "don" then file will contain
ddd
ddo

[code].....

View 1 Replies

Get All The Sentence Of The Text / Row Along With All Rows And Colms While Enter The Middle Of The Sentence / Word In The Input Box

May 2, 2009

I was created data bound grid with 5 colmns. And two cmds buttons and entered 200 data in all colmns. In the colm-5 text enter three or four line sentence like Seeta Rama Rao The following code to find the data of the rows and colmns.

[Code]...

View 2 Replies

Find The Longest Sentence And The Average Sentence Length In A Textbox?

May 22, 2011

After I input a few sentences in a textbox, I need to find the longest sentence in the textbox by clicking a button. The longest sentence should be displayed in a MessageBox.

View 2 Replies

How To Generate 3 Different Types Of Arrays

Jun 22, 2010

I want to generate 3 different types of arrays but 2 include a negative number and Im not really sure how to do that. The first type should generate 0 to 2 (which works):
num = Int(Rnd() * (2 - 0 + 1)) + 0
Now I need one that generates -1, 0, or 1.
and another that generates -2, -1, or 0.

View 1 Replies

Online List Of Random Words?

Mar 1, 2012

I am trying to get a random word in VB and was wondering if it was possible to do this through the internet some how? For example If there was a website that literally just contains random words (anything over 100 will do) and I could just select a random word from it? I can create random letters and numbers but I want a word that would be in a dictionary.

View 5 Replies

Selecting Random Words From An Array?

Nov 30, 2011

How would you select a random word from an array list. Here is my coding:

'Create a sub which reads the words from the file and selects a random word.
Sub ReadWordsFromFile(ByVal fileName As String, ByRef RandomWord As String)
'Create a random number generator.
Dim RandomNumber As New Random
Dim words As New ArrayList

[Code]...

View 7 Replies

VS 2008 : Random Generator For Words?

Jun 3, 2009

1. Is it possible to have vb.net piece together a legitimate word of a specified length, or do I need to have a massive word list, and generate a random number to pick a word from this list?

2. I also need to separate each letter of the word and display an image for each letter, and each letter going to the next based on a timer, and can also repeat on a button click.

Eg: TWO would end up displaying T W O, a few seconds apart from each other.

View 19 Replies

VS 2008 Random Words From A File?

Feb 2, 2012

I am making a program which generates Tambola Tickets. The program reads a list of movie names from a file and it randomly selects x no. of names per ticket and writes those names to a file.

For e.g. imagine there are 24 movie names. The program has to print 10 tickets and each ticket will habe 12 names.

I have written a program which does that but I think my random no. generator is repeating a few movie names pretty frequently.

plus I have to ensure that no one ticket can have a name repeated.

Dim NoTickets as Short = 10, Total as byte = 24 ' total = total movies in array
' Duplicate is function that ensures that no number is repeated
' MovieList is normal array with movie names

[Code].....

View 5 Replies

Multiple Line TextBox When The User Clicks The Generate Words Button?

Aug 30, 2009

I have been trying to figure out how to do this program for a few days. Here is the question.Write a Windows application that allows the user to enter a seven-letter combination corresponding to that number in a multiple line TextBox when the user clicks the Generate Words button.Avoid phone numbers with the digits 0&1.

I got some help from my instructor but I can't get anything in the listbox?

[Code]...

View 11 Replies

.net Program To Replace Random Words At Blanks?

Jan 25, 2011

program description:its a research paper editor and report builder program. i need to replace desired words with all blank spaces in the program

[Code]...

When i executed this program everything works fine.but all the blankspaces are replaced by only one word.

how should i get every individual blank space replaced by individual words.i mean i need to get every blank space in my research paper is replaced by different words

View 3 Replies

Getting Random Words From Text File Or String?

Jan 8, 2010

I am using VB2010 and currently have a random letter and number applicaation but for some reason students dont seem to have the ability to type these in correctly!Does anyone have some code to put words from text file or string into a text box.

[Code]...

View 8 Replies

Grab 10 Random Words From Text File?

Mar 16, 2010

I have a text document. i want to click a button and 10 random words out of the 196000 words shown in a textbox or listbox.

View 5 Replies

Vowel Search From List Of Random Words

Mar 18, 2009

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn5vowel.Click
Dim rand As New Random
Dim alphabet As String
Dim i As Integer
For i = 1 To 200
alphabet = ChrW(rand.Next("A"),to ("z")

It is giving me that the expression must be expected. I have to choose and display the fifth vowel from the list of 200 random words.

View 5 Replies

Generate 10 Random Numbers Between 1 And 52?

May 1, 2012

'm attempting a program and need to generate 10 random numbers between 1 and 52. However all the numbers must be different. I'm trying this in a For Loop. I'm not terribly amazing at this so all I have so far is:

Dim B, I, J, max, min, card() As Interger
max = 52
min = 1
Randomise()

[Code].....

What am I doing wrong and what is the ultimately simple solution I know the internet can provide for me?

View 4 Replies

Generate A Random Single-use URL?

Nov 30, 2011

I've published a different take on a log in system on CodeProject [URL] and I've got some free time, so I thought I'd have a look at password recovery/reset.It was suggested on the article that I look into sending the account owner a single use, random url where they can reset their password if the account gets locked because of too many invalid login attempts/forgotten password.So far, I'm thinking I just have to generate a random string in a "recovery" field in the database table for the user's row and then check if the requested URL on the site is the same as the value for that field, then dynamically draw the page server-side.

View 1 Replies

Generate A Random String?

Dec 21, 2011

i need to create a random string (length of 6) out of the following chars:

"0123456789abcdefghijklmnopqrstuwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

How could i do this?

My Sharepoint and Enterprise 2.0 Blog [URL]

View 4 Replies

Generate Numbers At Random

Jan 9, 2010

This code is in VB6.0I have 28 numbers in sequence (eg 1-28), they are randomly generated and displayed in a label. I dont want a duplicate number displayed in the label. Pls how do I do this. Below is how I generate numbers at random. Now I want to make sure there is no duplicate number displayed in the label.[code]

View 12 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved