My sentence generator, it's not finished though.

This is a discussion on My sentence generator, it's not finished though. within the C Programming forums, part of the General Programming Boards category; What I am now making is a sentence generator. I input a sentence, then the program makes another sentence. But ...

  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    229

    My sentence generator, it's not finished though.

    What I am now making is a sentence generator.
    I input a sentence, then the program makes another sentence.
    But the sentence the program makes has a undeclared word variable 'S'.
    I need to declare 'S' to be a english word.
    So that when 'S' is used in the two sentences it helps the two sentences make sense.

    What I have now in the first sentence is 'M' and 'P', I declare them to English words when I input the sentence.
    In the second sentence 'S' is used with 'M'.

    I discovered that if 'M' has a letter and vowel and if 'S' has the same letter and vowel the 'S' word makes sense in the sentence.
    So my plan is to pass the M word to the search function which compares the 'M' word to a list of words.
    I will then try and get a word from the list that has the same letter and vowel as the 'M' word and pass that into 'S'.
    The result should be S is the word from the list and the sentence makes sense.

    I hope to do this then get my syllogism program to open the two sentences the sentence generator makes and make a sentence conclusion.
    This conclusion is then passed into the sentence generator which makes another sentence and those two sentences are opened by the syllogism program.
    And after say 20 cycles of this I can read the results in a text file to see if it made any sense logically.

    remove the txt extension then unzip the folder to get the code.
    code.zip.txt

    Why am I posting this. I am tired and am hoping when I read this web page tomorrow I will see somebodies idea on how to solve this problem.
    I would work on it but I have been at it for over twelve hours so far.

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    I certainly would like to know how you expect to make an undeclared word variable, into a declared English word variable.

    Let alone hope it will make sense.

    Get some rest, Jeremy. 12 hours at it? You deserve it!

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    546
    you really should just post your code. most folks aren't going to unzip something off a message board.

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by dmh2000 View Post
    you really should just post your code. most folks aren't going to unzip something off a message board.
    Ummmm... the last time Jeremy did that we ended up with over 8500 lines of garbage code to weed through... balked my browser for nearly 5 minutes while rendering it it... in the end I just put the kid in my ignore file.

    Be very careful what you ask for!

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,558
    It's about the same again - nearly 10K lines of massive copy/paste.

    Gotta admire the enthusiasm, but you could do a lot more with a lot less if you learnt some more of the language.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Registered User
    Join Date
    Apr 2011
    Posts
    229
    I finished my sentence generator today.

    I will list the comments the code has so you don't think the program is too difficult:

    /* The function used to delete the newline character so that the sentences look formatted */
    /* The function to search text file for compatible word */
    /* function so I don't have to type getch all over the place */
    /* the main program */
    /* I declare my variables */
    /* The function is called so I don't have to type getch */
    /* I ask the user to enter text */
    /* I input a string and it is checked to see which while loop will process it.
    I use the while loop to give a word value to a array which is checked by the if statements in the next step */
    /* I check the word from the while loop to see what char values it has, so these values are passed to the search function.
    The search function then returns a word value from a list of words.*/
    /* I add string values to the variables not in the previous step. */
    /* I get rid of the newline so the sentences look formated, or else the sentences are on different lines */
    /* I print the results on the screen */
    /* I memset the arrays */

    So 13 steps, not too much going on.

    There is 13348 lines of code though, so a lot of reading if you read code.

    The code needs a list of words which I got from Kevins wordlist, over at sourceforge.
    I used the "Official 12Dicts Package", and the "2of12.txt", I just copied and pasted the list into the readlist.txt file and ran the program.
    Here are the sentence I used, note there is no period in the sentences and there are no caps used in any letter.
    ______________

    those are yours

    cars are wheeled

    songs are sung

    movies are stories

    shoes are tied

    letters are printed

    no canine is here

    no in is out

    no increasing is subtracting

    no wild is tame

    some friends are not friendly

    _________________________

    Below I will write out the results the program gave me after I entered each of the sentences above into the program.
    Read them and see if they make sense.

    1
    ____________
    Enter a sentence, all lower case.
    Rename X and Y with words, the new word must have both a letter and vowel in it.

    Formats of sentences:

    A.)X are Y
    B.)no X is Y
    C.)some X are not Y

    those are yours

    Camestros

    those are yours.
    No abattoir is yours.

    Baroco

    those are yours.
    Some abattoir are not yours.

    Darii

    those are yours.
    Some abashed are those.

    Darapti

    those are yours.
    those are abashed.

    Barbari

    those are yours.
    abashed are those.

    Barbara

    those are yours.
    abashed are those.
    Press any key to continue . . .
    ____________

    2
    ____________
    Enter a sentence, all lower case.
    Rename X and Y with words, the new word must have both a letter and vowel in it.

    Formats of sentences:

    A.)X are Y
    B.)no X is Y
    C.)some X are not Y

    cars are wheeled

    Camestros

    cars are wheeled.
    No abandoned is wheeled.

    Baroco

    cars are wheeled.
    Some abandoned are not wheeled.

    Darii

    cars are wheeled.
    Some abaci are cars.

    Darapti

    cars are wheeled.
    cars are abaci.

    Barbari

    cars are wheeled.
    abaci are cars.

    Barbara

    cars are wheeled.
    abaci are cars.
    Press any key to continue . . .
    ____________

    3
    ____________
    Enter a sentence, all lower case.
    Rename X and Y with words, the new word must have both a letter and vowel in it.

    Formats of sentences:

    A.)X are Y
    B.)no X is Y
    C.)some X are not Y

    songs are sung

    Camestros

    songs are sung.
    No accounting is sung.

    Baroco

    songs are sung.
    Some accounting are not sung.

    Darii

    songs are sung.
    Some abnegation are songs.

    Darapti

    songs are sung.
    songs are abnegation.

    Barbari

    songs are sung.
    abnegation are songs.

    Barbara

    songs are sung.
    abnegation are songs.
    Press any key to continue . . .
    ____________

    4
    ____________
    Enter a sentence, all lower case.
    Rename X and Y with words, the new word must have both a letter and vowel in it.

    Formats of sentences:

    A.)X are Y
    B.)no X is Y
    C.)some X are not Y

    movies are stories

    Camestros

    movies are stories.
    No abbreviate is stories.

    Baroco

    movies are stories.
    Some abbreviate are not stories.

    Darii

    movies are stories.
    Some abandonment are movies.

    Darapti

    movies are stories.
    movies are abandonment.

    Barbari

    movies are stories.
    abandonment are movies.

    Barbara

    movies are stories.
    abandonment are movies.
    Press any key to continue . . .
    ____________

    5
    ____________
    Enter a sentence, all lower case.
    Rename X and Y with words, the new word must have both a letter and vowel in it.

    Formats of sentences:

    A.)X are Y
    B.)no X is Y
    C.)some X are not Y

    shoes are tied

    Camestros

    shoes are tied.
    No abandoned is tied.

    Baroco

    shoes are tied.
    Some abandoned are not tied.

    Darii

    shoes are tied.
    Some abashed are shoes.

    Darapti

    shoes are tied.
    shoes are abashed.

    Barbari

    shoes are tied.
    abashed are shoes.

    Barbara

    shoes are tied.
    abashed are shoes.
    Press any key to continue . . .

    ____________

    6
    ____________
    Enter a sentence, all lower case.
    Rename X and Y with words, the new word must have both a letter and vowel in it.

    Formats of sentences:

    A.)X are Y
    B.)no X is Y
    C.)some X are not Y

    letters are printed

    Camestros

    letters are printed.
    No abandoned is printed.

    Baroco

    letters are printed.
    Some abandoned are not printed.

    Darii

    letters are printed.
    Some abalone are letters.

    Darapti

    letters are printed.
    letters are abalone.

    Barbari

    letters are printed.
    abalone are letters.

    Barbara

    letters are printed.
    abalone are letters.
    Press any key to continue . . .
    ____________

    7
    ____________
    Enter a sentence, all lower case.
    Rename X and Y with words, the new word must have both a letter and vowel in it.

    Formats of sentences:

    A.)X are Y
    B.)no X is Y
    C.)some X are not Y

    no canine is here

    Celarent

    no canine is here.
    abaci are canine.

    Celaront

    no canine is here.
    abaci are canine.

    Felapton

    no canine is here.
    canine are abaci.

    Ferio

    no canine is here.
    Some abaci are canine.
    Press any key to continue . . .
    ____________

    8
    ____________
    Enter a sentence, all lower case.
    Rename X and Y with words, the new word must have both a letter and vowel in it.

    Formats of sentences:

    A.)X are Y
    B.)no X is Y
    C.)some X are not Y

    no in is out

    Celarent

    no in is out.
    abbreviation are in.

    Celaront

    no in is out.
    abbreviation are in.

    Felapton

    no in is out.
    in are abbreviation.

    Ferio

    no in is out.
    Some abbreviation are in.
    Press any key to continue . . .
    ____________

    9
    ____________
    Enter a sentence, all lower case.
    Rename X and Y with words, the new word must have both a letter and vowel in it.

    Formats of sentences:

    A.)X are Y
    B.)no X is Y
    C.)some X are not Y

    no increasing is subtracting

    Celarent

    no increasing is subtracting.
    abaci are increasing.

    Celaront

    no increasing is subtracting.
    abaci are increasing.

    Felapton

    no increasing is subtracting.
    increasing are abaci.

    Ferio

    no increasing is subtracting.
    Some abaci are increasing.
    Press any key to continue . . .
    ____________

    10
    ____________
    Enter a sentence, all lower case.
    Rename X and Y with words, the new word must have both a letter and vowel in it.

    Formats of sentences:

    A.)X are Y
    B.)no X is Y
    C.)some X are not Y

    no wild is tame

    Celarent

    no wild is tame.
    abbreviated are wild.

    Celaront

    no wild is tame.
    abbreviated are wild.

    Felapton

    no wild is tame.
    wild are abbreviated.

    Ferio

    no wild is tame.
    Some abbreviated are wild.
    Press any key to continue . . .
    ____________

    11
    ____________
    Enter a sentence, all lower case.
    Rename X and Y with words, the new word must have both a letter and vowel in it.

    Formats of sentences:

    A.)X are Y
    B.)no X is Y
    C.)some X are not Y

    some friends are not friendly

    Bocardo

    some friends are not friendly.
    friends are abandoned.
    Press any key to continue . . .
    ____________

    Now from the wordlist it is only getting to use the A section.
    I wonder what the results would be if the other letter sections were used too?
    But right now the results seem to be positive.
    With these results I think I could run it throught my syllogism program and get a logical conclusion which could be fed back into the sentence generator.
    Now if only the program could learn from it's sentence and conclusion making, then it could start to think !

    Here's the file. Just remove the txt extension and unzip it.

    code.zip.txt

    If I put the two program together it might be a thrill to see it running perpetually and making sense, but the program isn't learning anything while it does it, so joining the two program is useless to be.
    I need to learn how to make sw learn, and I wonder if anybody here might know how it can do that using my two programs.

    because if I can make the sw learn then with these two program: sentence generator, syllogism conclusion maker, I have an Artificial Intelligence.

  7. #7
    Registered User
    Join Date
    Apr 2011
    Posts
    229
    So I said I was going to join my two programs, the syllogism conclusion maker and sentence generator, and here it is:

    link

    Here's the results:

    Enter a sentence, all lower case.
    Rename X and Y with words, the new word must have both a letter and vowel in it.

    Formats of sentences:

    A.)X are Y
    B.)no X is Y
    C.)some X are not Y

    movies are stories

    __________________________________________

    Type Camestros (AEO-2) Syllogism pattern found
    P are M
    No S is M


    movies are stories.
    No abbreviate is stories.
    Some abbreviate are not movies

    __________________________________________

    Type Baroco (AOO-2) Syllogism pattern found
    P are M
    Some S are not M


    movies are stories.
    Some abbreviate are not stories.
    Some abbreviate are not movies

    __________________________________________

    Type Darii (AII-1) Syllogism pattern found
    M are P
    Some S are M


    movies are stories.
    Some abandonment are movies.
    Some abandonment are stories

    __________________________________________

    Type Barbara (AAA-1) or Darapti (AAI-3) or Barbari (AAI-1)Syllogism pattern foun
    d
    M are P
    S are M or M are S


    Darapti

    movies are stories.
    movies are abandonment.
    Some abandonment are stories

    Barbari

    movies are stories.
    movies are abandonment.
    Some movies are stories

    Barbara

    movies are stories.
    movies are abandonment.
    movies are stories

    __________________________________________

    Type Barbara (AAA-1) or Darapti (AAI-3) or Barbari (AAI-1)Syllogism pattern foun
    d
    M are P
    S are M or M are S


    Darapti

    movies are stories.
    abandonment are movies.
    Some movies are stories

    Barbari

    movies are stories.
    abandonment are movies.
    Some abandonment are stories

    Barbara

    movies are stories.
    abandonment are movies.
    abandonment are stories

    __________________________________________

    Type Barbara (AAA-1) or Darapti (AAI-3) or Barbari (AAI-1)Syllogism pattern foun
    d
    M are P
    S are M or M are S


    Darapti

    movies are stories.
    abandonment are movies.
    Some movies are stories

    Barbari

    movies are stories.
    abandonment are movies.
    Some abandonment are stories

    Barbara

    movies are stories.
    abandonment are movies.
    abandonment are stories

    Press any key to continue . . .

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Random Sentence Generator
    By jlangfo5 in forum General AI Programming
    Replies: 1
    Last Post: 10-13-2010, 01:22 PM
  2. random sentence generator
    By jsbeckton in forum C Programming
    Replies: 19
    Last Post: 10-14-2005, 04:23 PM
  3. Finished C++ 1
    By sonict in forum C++ Programming
    Replies: 15
    Last Post: 01-26-2003, 03:47 AM
  4. Finished!
    By Kyoto Oshiro in forum C++ Programming
    Replies: 22
    Last Post: 07-21-2002, 01:40 PM
  5. Finished
    By Kavity in forum C++ Programming
    Replies: 1
    Last Post: 08-26-2001, 11:59 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21