AI stuff

This is a discussion on AI stuff within the General Discussions forums, part of the Community Boards category; Hey guys, so yesterday I got done with a program and submitted it only to find out I didn't have ...

  1. #1
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    230

    AI stuff

    Hey guys, so yesterday I got done with a program and submitted it only to find out I didn't have to do that one...

    so I have adopted it as my project. What is this project one might ask.
    well this project is an AI type thing called Eliza. It was first made by Joseph Weizenbaum. of course we didn't have to make a full blown copy, but we did have to respond to a 'my' statement.

    For example "MY brother is being mean"

    the program would then respond: "Tell me more about your brother."

    My project I am trying to do is make it more intelligent. For example being able to respond to a lot of different inputs. I have started on it tonight but this is only the thinking stage.

    Here is what I am thinking the program will do

    First in one 'class' (I am programming this in Java because thats what I started with) a class is basically just a bunch of functions in another file.
    Anyway the first class starts by taking the string and sending it off to another class which coordinates everything. the program then goes
    off to another class to find out what type of word the word is like a noun
    or a verb or something.

    Thats as far as I can get in my head. I don't know where I should go from there. I know Watson's creators said that they pieced apart the
    string to find the meaning of it in English, so basically Watson knew
    English.

    If anyone could help me with this that would be very appreciated.

    Thanks

  2. #2
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,534
    We can convert 'my' to 'your' easily in our minds, because we've been trained to do so. Likewise with myriads of other linguistic patterns.
    You can hardcode this, and other common examples. Or, train a design to do it. But your only realistic option will probably be a combination of the two.

    I can't think of which one, but I think one of the public chatterbots out and about right now, is partially trained by the very people it communicates with. The idea is that thousands of conversions, key patterns will be discovered and implemented automatically.

    I know that's not very much help. But this _is_ AI. AI is hard.

  3. #3
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,288
    How complex this is depends on exactly how intelligent you want this to be. The broader subject (beyond chat bots) you should look into is called natural language processing. I can't give you any specific references on the subject since I've never delved too far into it.

    We have compilers that process computer languages very effectively, but human languages are hard. Computer languages have a tiny vocabulary and a fairly simple, unambiguous grammar. Human languages have complex grammar with lots of ambiguity and a huge vocabulary.

    Watson took years of development by some of the worlds brightest engineers and had immensely powerful hardware and software. It "read" a huge corpus and retained virtually all of the useful info in there, and even though Watson won, it had serious failings when trying to understand more abstract concepts and "indirect" speech devices like analogies and metaphors. It beat the human components in large part because Jeopardy questions tend to be concrete and direct.

    The simplest chat bot that can handle a few different sentence forms and reply in a very basic manner can be coded fairly easily by looking for patterns with some if/else statements and scanf trickery. For example, your bot can assume that articles ("the", "a", "an") almost always precede a noun phrase, so you can do something like sscanf(input, " the %s", word) and then respond with printf("tell me about %s", word). You can repeat that for "the", "a", "an", "my", "your", etc. You can step it up by keeping a list of the noun indicators, their "inverse" (if person A says "my brother", you respond with "your brother"), and keep similar lists for verbs, so you have a more "algorithmic" approach instead of a fugly mess of if-else statements.

    Going much beyond that gets tough. What if you have "my <adjective> <noun>", like "my blue shirt", or "my <adjective> <adjective> <adjective> <noun>", like "my favorite blue polo shirt". How do you know how many adjectives there are before you get to the noun itself? Even handling seemingly simple phrases like that require you to build a sentence diagram or parse tree and analyze that tree to discern the actual nouns and verbs.

    I hope I didn't discourage you too much. You really should look into it, even if you don't build a Watson clone. NLP is very fascinating.

  4. #4
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,288
    Quote Originally Posted by Yarin View Post
    I can't think of which one, but I think one of the public chatterbots out and about right now, is partially trained by the very people it communicates with. The idea is that thousands of conversions, key patterns will be discovered and implemented automatically.
    Maybe you're thinking of Cleverbot? Some of these chat bots determine responses "statistically". They analyze other conversations and determine the most likely response to "what's up?" or "how's it going?", and reply in kind. AFAIK, it's a bit like a giant lookup table of statements and replies. I'm sure there's more to it than that, reducing equivalent statements to a common form, for example ("what's up", "sup", etc). It does give the appearance of comprehension at times, but I don't find it very intelligent (just "clever" as the name implies). It's also why it fails so hard at producing a lengthy conversation that makes sense. It doesn't try to understand what the other person says and reply accordingly, and it doesn't hold a lot of history or context of the conversation.

  5. #5
    Just a pushpin. bernt's Avatar
    Join Date
    May 2009
    Posts
    426
    One of the simpler bots to study is ALICE. There is a wealth of information about how it works at that website as well. And despite its simple pattern-response nature, its creators were pretty clever IMO; it actually won the Loebner prize a few times in years past.

    Quote Originally Posted by Yarin
    I can't think of which one, but I think one of the public chatterbots out and about right now, is partially trained by the very people it communicates with.
    Jabberwacky claims to be trained entirely through conversations.
    Consider this post signed

  6. #6
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    230
    Quote Originally Posted by anduril462 View Post
    It's also why it fails so hard at producing a lengthy conversation that makes sense. It doesn't try to understand what the other person says and reply accordingly, and it doesn't hold a lot of history or context of the conversation.
    Thats exactly what I was thinking. Cleverbot is so dumb. Its kind of daunting to try to make something like that when it scored a 59% on the turning test.

    also another one of my ideas was to hold all the verbs that are recurring in common speech in a file and if a word is suspected to be a verb it could search the file to see if it can find that verb and make something logical of a sentence. This would be true with all other parts of speech too.

    Another thing is that misspelling is a big problem. If you misspell something the program is pretty much in the dark about what you are saying.

    Also another idea I had is if the sentence starts with 'is' it must be a yes or no question. Also if a sentence starts with a 'question word' it must be a question.

    Also if you guys want me to post the code I can. Its all in Java but if you know C its pretty straight forward.

    I almost forgot. I did post a video on Youtube of the current way it works. You can view it here if you really want to see it.

  7. #7
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,288
    Quote Originally Posted by xniinja View Post
    also another one of my ideas was to hold all the verbs that are recurring in common speech in a file and if a word is suspected to be a verb it could search the file to see if it can find that verb and make something logical of a sentence. This would be true with all other parts of speech too
    Common verbs often function as nouns as well, describing the action itself, or referring to the act of doing something. Take for example "walk". "I'm going for a walk." (noun) or "I walk to work." Of course, you can use tricks like if it's preceded by an article, it's a noun, if it's followed by a preposition, it's a verb. But you also have sentences with no articles or prepositions, like "I walk daily."

    Another thing is that misspelling is a big problem. If you misspell something the program is pretty much in the dark about what you are saying.
    How do you think your word processing program or cell phone can guess what word you meant to type? There are algorithms for determining which word the user most likely wanted to type. Your program could implement that, it's just more work.

    Also another idea I had is if the sentence starts with 'is' it must be a yes or no question. Also if a sentence starts with a 'question word' it must be a question.
    That probably works. I feel like that's not true 100% of the time, but I can't think of a counter example (apart from the trivial "'Is' can be the start of a non-question sentence."), so go with it. Unfortunately, that's not sufficient for identifying all questions.

    Also if you guys want me to post the code I can. Its all in Java but if you know C its pretty straight forward.

    I almost forgot. I did post a video on Youtube of the current way it works. You can view it here if you really want to see it.
    Looks like you're off to a good start. Posting the code would be good if you want help, though if it's really long, I might suggest attaching files or using something like pastebin.

  8. #8
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    230
    Eliza.c I have attached the file. It is not a .c file it should be a .java file but I named it to .c so the site would allow it.

    I am also going to be redesigning the whole thing from the ground up so it is a more friendly design for this type of program.

    Also if you have any syntax questions just ask. This isn't a Java forum but it is a supporting community with a lot of smart people and I don't want to try and find another forum with as awesome people. Thats why I am posting this here.

    Thanks

    EDIT: I didn't post the code because it is 170 lines long. if you guys don't care I will post the whole thing.

  9. #9
    and the hat of copycat stevesmithx's Avatar
    Join Date
    Sep 2007
    Posts
    489
    Don't know how much it would help, but there is some good educational content currently going on at https://www.ai-class.com/
    Not everything that can be counted counts, and not everything that counts can be counted
    - Albert Einstein.


    No programming language is perfect. There is not even a single best language; there are only languages well suited or perhaps poorly suited for particular purposes.
    - Herbert Mayer

  10. #10
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    230
    Thanks but I pretty much have it figured out. I will post the flowcharts when I am done with them...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Some stuff I did.
    By taelmx in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 11-05-2006, 12:26 PM
  2. Need ref for some C++ stuff...
    By hypertension in forum C++ Programming
    Replies: 2
    Last Post: 11-11-2003, 04:24 AM
  3. Your stuff
    By smog890 in forum C Programming
    Replies: 6
    Last Post: 06-13-2002, 11:50 PM
  4. stuff
    By Dude101 in forum C++ Programming
    Replies: 2
    Last Post: 10-16-2001, 07:39 PM

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