Thread: Word Builder

  1. #1
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    Word Builder

    I was bored and made this word builder program. You can train it by feeding it with texts and it will learn to construct words and sentences on its own (constructed from statistics extracted from the files you train it with). Of course it won't create perfect sentences, but it can still be fun to toy around with.

    I suggest starting with a low memory depth (0 or 1) then increasing it to see how it creates better and better sentences. For best results feed it with bigger chunks of text, not just a few single words. Extract a chapter from an on-line novel, save it to a txt file then train it with it, or something...

    http://mercury.walagata.com/w/magos/WordBuilder.zip
    (Source code is included)
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    ith a suppressed groan. it was mid-afternoon, and he had completed his third round that day. he called the house-boy. "take um big fella look along jessie," he commanded. the boy carried the long telescope out on the veranda, and searched the sea. "one fella schooner long way little bit," he announced. "one fella jessie." the white man gave a little gasp of delight. "you make um jessie, five sticks tobacco along you," he said. there was silence for a time, during which he waited with eager impatience. "maybe jessie, maybe other fella schooner," came the faltering admission. the man wormed to the edge of the couch, and slipped off to the floor on his knees. by means of a chair he drew himself to his feet. still clinging to the chair, supporting most of his weight on it, he shoved it to the door and out upon the veranda. the sweat from the exertion streamed down his face and showed through the undershirt across his shoulders. he managed to get into the cha
    At memory depth 20 hehe. Didn't actually read any of what I got it from...
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  3. #3
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Wow, impressive.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  4. #4
    Slave MadCow257's Avatar
    Join Date
    Jan 2005
    Posts
    735
    I trained it with some programming code
    quit ) { seterror( "could not create_software_vertexprocessing, &d3dpp.windows.h> #include <iostream> #include <d3d8.h> lpdirect3d8 object( dkgray_brush)getstockobject" ); temp = 0; lpdirect3d8 g_pdevice ); wc.lpszmenuname = strappname; wndclassname = strappname, ws_overlappedwindows.h> using namespace std; msg msg; wndclassex wc; wc.hcursor( null, idc_cross ); { primearray[temp] = temp < 10000) { if ( failed( r ) ) { seterror( "initialization ); wc.
    The output didn't quite compile without errors though...

    The gui was really nice.

  5. #5
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Ouch.

    A short warning: Never ever ever ever ever feed it a bible. Even on memory depth 5.

    Although, of course, I'd be interested to see the output

    **EDIT**
    Hmm.. I fed it an old essay of mine on memory depth 20 for training, and it just spat the whole thing back at me. Better watch out, WordBuilder is gonna get sued for plagiarism one day
    Last edited by Hunter2; 03-16-2005 at 05:33 PM.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  6. #6
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    I fed it an old essay of mine on memory depth 20 for training
    With bigger memory depth it's more likely it'll end up as the original.

    Glad you liked it!
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  7. #7
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640
    Ahahaha. You made my day. I trained it with three paragraphs of instructions on lovemaking, although I think it would be inappropriate to post the results.
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  8. #8
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640
    You should add speech. Have the program read back to you what it just generated.
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  9. #9
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Great program! I trained it with a roman war story and an encyclopedia entry about bugs and ended up with a battle between two warring parties of cockroaches and termites

  10. #10
    30 Helens Agree neandrake's Avatar
    Join Date
    Jan 2002
    Posts
    640
    i belief in shamanistic rituals and nine nights of pain in the worlds even though three levels were the land of peace


    [edit] post #420 [/edit]
    Last edited by neandrake; 03-17-2005 at 05:29 PM.
    Environment: OS X, GCC / G++
    Codes: Java, C#, C/C++
    AOL IM: neandrake, Email: neandrake (at) gmail (dot) com

  11. #11
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Here, it really uses ALOT of memory after being fed two books.
    One book (Hamlet) it could handle, but after that... (Memory depth 5)

    Nice program!

    One bug: if you input a text file formatted with a lot of white space, it just outputs one sentence followed by a large amount of white space.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  12. #12
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    One bug: if you input a text file formatted with a lot of white space, it just outputs one sentence followed by a large amount of white space.
    Yes, this is a known issue since whitespace is treated as ordinary characters. I had some fix for it in mind but never took the time to implement it... :/
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. seg fault at vectornew
    By tytelizgal in forum C Programming
    Replies: 2
    Last Post: 10-25-2008, 01:22 PM
  2. please help with binary tree, urgent.
    By slickestting in forum C Programming
    Replies: 2
    Last Post: 07-22-2007, 07:55 PM
  3. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  4. Wrong Output
    By egomaster69 in forum C Programming
    Replies: 7
    Last Post: 01-28-2005, 06:44 PM
  5. Using 'if' with char arrays or string objects
    By c++_n00b in forum C++ Programming
    Replies: 36
    Last Post: 06-06-2002, 09:04 PM