CodeWalrus

Development => Web => Topic started by: Ephraim Becker on November 11, 2015, 02:03:56 PM

Title: Virtual friend
Post by: Ephraim Becker on November 11, 2015, 02:03:56 PM
I'm working on programming a Virtual friend in HTML, CSS, and JavaScript. The purpose is to help me with my conversations. You can download and see my progress on my Virtual friend at https://github.com/EphraimB/Virtual-Friend
Title: Re: Virtual friend
Post by: p4nix on November 11, 2015, 02:12:03 PM
Chat programs are quite cool. But the approach you use for questions and answers is a little bit too hardcoded (no insult, you are a way better programmer than me, if I look at your github). I think it's very hard to write a good chatbot, but this gives ok results with a very minimalistic approach (you probably know ELIZA already though):
https://en.wikipedia.org/wiki/ELIZA

EDIT:
I see that you want to also force yourself (or whoever is talking to your virtual friend) to let conversations run - that might be hard to achive on an ELIZA like setup...
Title: Re: Virtual friend
Post by: Ephraim Becker on November 11, 2015, 02:23:02 PM
I'm doing this from scratch.
Title: Re: Virtual friend
Post by: p4nix on November 11, 2015, 02:24:45 PM
Sure, I've seen that. But if I'm not wrong you hardcode questions and answers at the moment. I mean you know what to ask your bot to get the conversation running, but I only got 'Huh?'.
Title: Re: Virtual friend
Post by: Ephraim Becker on November 11, 2015, 02:30:54 PM
Quote from: p4nix on November 11, 2015, 02:24:45 PM
Sure, I've seen that. But if I'm not wrong you hardcode questions and answers at the moment. I mean you know what to ask your bot to get the conversation running, but I only got 'Huh?'.

By that part you have to type the following exactly:
"What are your interests?"
Title: Re: Virtual friend
Post by: p4nix on November 11, 2015, 02:32:13 PM
That's my point. Of course I've looked at your javascript - but a conversation isn't an algorithm. At least not a simple one.
Title: Re: Virtual friend
Post by: novenary on November 11, 2015, 02:33:23 PM
He wasn't suggesting that you use a library or anything, but that you take a look at other people's algorithms since chatbots have been made before and it's a good idea to take inspiration from existing things.
Programming isn't only about the language and libraries you use but also about design: algorithms and data structures are two things that you need to master and the best way to learn is to look at what others have done and see if you can come up with a better implementation or even an improved algorithm.

There is a lot of theory behind analyzing a sentence written by a human to extract its meaning and then compose a new sentence in reply. Go read up, you won't regret it. :)
Title: Re: Virtual friend
Post by: Ephraim Becker on November 11, 2015, 02:36:31 PM
The main point of programming this is to learn how to converse with people better. I, for some reason, think in code better than English. So programming this from scratch would help me better with my conversations.
Title: Re: Virtual friend
Post by: p4nix on November 11, 2015, 02:46:34 PM
I totally got your point - and please note that I try to help you.
A conversation isn't linear at all - it's complex, twisted and... complex. And if you want to learn how to talk, you'll have to get a realistic conversation. I don't know if you know the turing-test (am I human, am I machine?), but that's what a chatbot has to try to achieve. I am not talking about ELIZA, I am talking about the method ELIZA uses to achieve that - it's a quite simple approach and it's based on the fact that a doctor can drive a realistic looking conversation by asking questions related to the topic you are talking about repeatedly.
However, even that approach is far away from being realistic, but it's way better than what you are trying to do now (no insult, but it will not work).

Anyway, the best way to learn talking is to start conversations in real life - even with people you don't know.

EDIT:
Even if you like your approach and even if you want to keep it - please take a look at this: https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=5369&lngWId=3
Title: Re: Virtual friend
Post by: Ephraim Becker on November 11, 2015, 08:05:25 PM
After a day of hard work, Virtual friend 0.2.0 is released on GitHub. You can download it at the following link:
https://github.com/EphraimB/Virtual-Friend/releases/tag/0.2.0

This second beta release is based on the time of day
Title: Re: Virtual friend
Post by: p4nix on November 11, 2015, 08:11:54 PM
Somehow I am stuck on the question 'Good evening! What's your name?' now :(
Title: Re: Virtual friend
Post by: Ephraim Becker on November 11, 2015, 08:15:57 PM
Ooops! My bad. I'm going to have to fix that problem. I will release 0.2.1 shortly.

Update: I just released 0.2.1 but I had to sacrifice the greeting based on the time of day feature. You can download 0.2.1 at the following link:
https://github.com/EphraimB/Virtual-Friend/releases/tag/0.2.1
Title: Re: Virtual friend
Post by: Dream of Omnimaga on November 11, 2015, 08:56:39 PM
Keep in mind that it's going to be impossible to get an AI that interacts 100% like humans. The feelings won't be emulated, for example (eg being angry, happy, etc), because so many things can alter them, and there will always be akward stuff happening when interacting with a bot. Also, in order to create a virtual friend that can help you socialize, it would need to be written by someone who has very good socializing skills in order to allow you to improve much. I personally wouldn't rely on a bot to improve my communication skills (*cough*especially not Nikkybot :P*cough*)


It can be a good learning experience, though, to make such bot, and AI bots tend to be quite popular sometimes.
Title: Re: Virtual friend
Post by: alexgt on November 11, 2015, 11:04:24 PM
Great idea Ephriam!!! but I think that all the other people are right also :).

I think Nikkybot would give anybody a distinct distaste for communication IRL if you went solely off of that interaction :P
Title: Re: Virtual friend
Post by: Ephraim Becker on November 12, 2015, 01:09:42 AM
I just released virtual friends 0.2.3 which brings the feature I had to sacrifice in 0.2.1 finally back!

You can download it here:
https://github.com/EphraimB/Virtual-Friend/releases/tag/0.2.3
Title: Re: Virtual friend
Post by: p4nix on November 12, 2015, 01:19:53 PM
Cool, I like the 'friends'-feature when you say that you share the same interests :) But if you ever get tired of hardcoding all 10^99999999999 possible dialogs, please keep real AI in mind. Anyway, I hope that this helps you, and maybe also others!
Title: Re: Virtual friend
Post by: Ephraim Becker on November 15, 2015, 03:29:36 PM
Virtual friend version 0.3.0 is getting closer! I just got fetching and displaying RSS feeds from the internet to work thanks to Google AJAX Feed API. Now all I need to do is modify the feed into a conversation about it.
Title: Re: Virtual friend
Post by: alexgt on November 15, 2015, 05:24:47 PM
Awesome, if I have time I will try 0.3 out ;)
Title: Re: Virtual friend
Post by: Ephraim Becker on November 15, 2015, 08:08:07 PM
Quote from: alexgt on November 15, 2015, 05:24:47 PM
Awesome, if I have time I will try 0.3 out ;)

0.3.0 is not released yet. It will still take some time.
Title: Re: Virtual friend
Post by: alexgt on November 15, 2015, 08:47:36 PM
What will 0.3.0 add? I saw internet connectivity O.O
Title: Re: Virtual friend
Post by: Ephraim Becker on November 18, 2015, 03:10:11 AM
Virtual friend is now live at http://ephraimb.github.io/Virtual-Friend/
Title: Re: Virtual friend
Post by: Dream of Omnimaga on November 18, 2015, 06:37:30 AM
Is it supposed to reply "Can you please repeat yourself?" to anything by the way?
Title: Re: Virtual friend
Post by: p4nix on November 18, 2015, 09:42:04 AM
I guess not to anything, it should at least repeat your name. But take a look at this for the solution:
http://ephraimb.github.io/Virtual-Friend/js/script.js
Title: Re: Virtual friend
Post by: Ephraim Becker on November 22, 2015, 11:59:05 PM
Virtual friend 0.3.0 is going to be ready very soon! It will fetch all the news feeds from http://www.npr.org, the only RSS feeds with CORS support. You can check out 0.3.0 beta at: http://ephraimb.github.io/Virtual-Friend
Title: Re: Virtual friend
Post by: Dream of Omnimaga on November 23, 2015, 01:13:11 AM
By the way, if you want help you really should indent your code. I understand that getting used to it would be hard as asperger (from experience) but No one wants to help because it's not intended and they can't read it x.x.
Title: Re: Virtual friend
Post by: Ephraim Becker on November 23, 2015, 02:38:30 PM
Virtual friend version 0.3.0 is finally out. You can view it live on my website: http://ephraimb.github.io/Virtual-Friend


or


You can download it at this link: https://github.com/EphraimB/Virtual-Friend/releases/tag/0.3.0
Title: Re: Virtual friend
Post by: Dream of Omnimaga on November 23, 2015, 09:51:51 PM
You should make the submit button also work with Enter like when searching Google. Having to click it with the mouse when submitting text gets a bit tedious.
Title: Re: Virtual friend
Post by: DarkestEx on November 24, 2015, 06:50:55 PM
I don't want to hurt you or be rude, but your Virtual Friend project is not ever getting anywhere near being useful as the current path that you are taking is not going to work. It does not look very visually appealing yet, but I guess that's subject to come later. Also I actually had to dissect the code just to know what I could ask him/her as this was not obvious at all when looking at the site itself.
With that I don't want to say that your project is bad or that you shouldn't keep working on it, as it is something that makes you have fun doing. But if you want this project not to be just for you, then you should really consider some drastic changes.
Also if you want to get some inspiration, check out CleverBot (http://www.cleverbot.com/). You can actually somewhat talk to it and often get good responses. Keep the work up, but I'd really suggest, starting from scratch. An if based conversation that just comares the input to all phrases preprogrammed is not going to work. You need to come up with some algorithm to estimate what the user is actually saying.

Edit: I mean look, I just talked to CleverBot again and it makes all sense and he certainly understood me: http://www.cleverbot.com/conv/201511241850/VWO03928850_Hello
Title: Re: Virtual friend
Post by: Dream of Omnimaga on November 25, 2015, 12:10:30 AM
It would probably help to suggest what in particular needs change, though. From what I could gather, some stuff is not proper AI but rather command-based stuff, so that is something that would need changes, but I didn't have much time to check the code for string of text and stuff besides the RSS feed stuff.
Title: Re: Virtual friend
Post by: Ephraim Becker on November 27, 2015, 12:27:46 AM
Virtual friend version 0.4.0 is finally out. You can view it live on my website: http://ephraimb.github.io/Virtual-Friend

or

You can download it at this link: https://github.com/EphraimB/Virtual-Friend/releases/tag/0.4.0
Title: Re: Virtual friend
Post by: DarkestEx on November 27, 2015, 12:30:42 AM
Quote from: Ephraim Becker on November 27, 2015, 12:27:46 AM
Virtual friend version 0.4.0 is finally out. You can view it live on my website: http://ephraimb.github.io/Virtual-Friend

or

You can download it at this link: https://github.com/EphraimB/Virtual-Friend/releases/tag/0.4.0
You are ignoring feedback altogether, aren't you [emoji19]
Title: Re: Virtual friend
Post by: Ephraim Becker on November 27, 2015, 12:39:46 AM
Quote from: DarkestEx on November 27, 2015, 12:30:42 AM
Quote from: Ephraim Becker on November 27, 2015, 12:27:46 AM
Virtual friend version 0.4.0 is finally out. You can view it live on my website: http://ephraimb.github.io/Virtual-Friend

or

You can download it at this link: https://github.com/EphraimB/Virtual-Friend/releases/tag/0.4.0
You are ignoring feedback altogether, aren't you [emoji19]

What feedback am I ignoring?
Title: Re: Virtual friend
Post by: DarkestEx on November 27, 2015, 12:41:40 AM
Quote from: Ephraim Becker on November 27, 2015, 12:39:46 AM
Quote from: DarkestEx on November 27, 2015, 12:30:42 AM
Quote from: Ephraim Becker on November 27, 2015, 12:27:46 AM
Virtual friend version 0.4.0 is finally out. You can view it live on my website: http://ephraimb.github.io/Virtual-Friend

or

You can download it at this link: https://github.com/EphraimB/Virtual-Friend/releases/tag/0.4.0
You are ignoring feedback altogether, aren't you [emoji19]

What feedback am I ignoring?
You haven't answered or gave any response to all these comments:
Quote from: DJ Omnimaga on November 23, 2015, 01:13:11 AM
By the way, if you want help you really should indent your code. I understand that getting used to it would be hard as asperger (from experience) but No one wants to help because it's not intended and they can't read it x.x.

Quote from: DJ Omnimaga on November 23, 2015, 09:51:51 PM
You should make the submit button also work with Enter like when searching Google. Having to click it with the mouse when submitting text gets a bit tedious.

Quote from: DarkestEx on November 24, 2015, 06:50:55 PM
I don't want to hurt you or be rude, but your Virtual Friend project is not ever getting anywhere near being useful as the current path that you are taking is not going to work. It does not look very visually appealing yet, but I guess that's subject to come later. Also I actually had to dissect the code just to know what I could ask him/her as this was not obvious at all when looking at the site itself.
With that I don't want to say that your project is bad or that you shouldn't keep working on it, as it is something that makes you have fun doing. But if you want this project not to be just for you, then you should really consider some drastic changes.
Also if you want to get some inspiration, check out CleverBot (http://www.cleverbot.com/). You can actually somewhat talk to it and often get good responses. Keep the work up, but I'd really suggest, starting from scratch. An if based conversation that just comares the input to all phrases preprogrammed is not going to work. You need to come up with some algorithm to estimate what the user is actually saying.

Edit: I mean look, I just talked to CleverBot again and it makes all sense and he certainly understood me: http://www.cleverbot.com/conv/201511241850/VWO03928850_Hello

Quote from: DJ Omnimaga on November 25, 2015, 12:10:30 AM
It would probably help to suggest what in particular needs change, though. From what I could gather, some stuff is not proper AI but rather command-based stuff, so that is something that would need changes, but I didn't have much time to check the code for string of text and stuff besides the RSS feed stuff.
Title: Re: Virtual friend
Post by: Ephraim Becker on November 27, 2015, 12:43:03 AM
I actually indented my code. Take a look at it now!
Title: Re: Virtual friend
Post by: DarkestEx on November 27, 2015, 12:43:49 AM
Quote from: Ephraim Becker on November 27, 2015, 12:43:03 AM
I actually indented my code. Take a look at it now!
OK granted that, but you have not replied to of them.
Title: Re: Virtual friend
Post by: Ephraim Becker on November 27, 2015, 12:44:49 AM
Quote from: DarkestEx on November 27, 2015, 12:43:49 AM
Quote from: Ephraim Becker on November 27, 2015, 12:43:03 AM
I actually indented my code. Take a look at it now!
OK granted that, but you have not replied to of them.

I'm going to try to listen to more of the feedback in the next release, 0.5.0
Title: Re: Virtual friend
Post by: Ephraim Becker on November 29, 2015, 12:01:18 AM
Virtual friend 0.5.0 is released with the following features:


1) The enter key now also submits your reply
2) You can now reply in full sentences


The update is now live on my website, http://ephraimb.github.io/Virtual-Friend, and available for download at https://www.github.com/EphraimB/Virtual-Friend
Title: Re: Virtual friend
Post by: Dream of Omnimaga on November 29, 2015, 07:09:07 AM
Does this release also includes some of the other suggestions quoted above? I am also curious about  if it will reply to stuff now.

A nice feature would be logs, so we can copy/paste convos.
Title: Re: Virtual friend
Post by: Ephraim Becker on November 29, 2015, 01:00:49 PM
Quote from: DJ Omnimaga on November 29, 2015, 07:09:07 AM
Does this release also includes some of the other suggestions quoted above? I am also curious about  if it will reply to stuff now.
Yes. The enter key now works!

Quote
A nice feature would be logs, so we can copy/paste convos.
I want it to act closely to a human being as possible. I'm probably, in a later release, going to allow the Virtual friend to share what you say to it, just like regular human beings can do.

I'm also planning a feature that you can speak to the Virtual friend and, at some point, get it to understand different tones of voice.
Title: Re: Virtual friend
Post by: Dream of Omnimaga on November 29, 2015, 10:46:28 PM
I think you should focus on text-based communications for now. Make it so it has an artificial intelligence so that it can function somewhat normally (eg Nikkybot style)
Title: Re: Virtual friend
Post by: Ephraim Becker on December 01, 2015, 11:28:56 PM
Virtual friend 0.6.0 is released. It can now recognize your name when you type what your name is in a full sentence and allow you to select multiple interests (although it doesn't make any use of it yet (maybe 0.7.0)).


You can download 0.6.0 at: https://github.com/EphraimB/Virtual-Friend/releases/tag/0.6.0


or


You can view it on my website at: http://ephraimb.github.io/Virtual-Friend
Title: Re: Virtual friend
Post by: Dream of Omnimaga on December 02, 2015, 02:21:58 AM
What kind of interests can it detect?
Title: Re: Virtual friend
Post by: Ephraim Becker on December 04, 2015, 09:01:29 PM
Technology, Movies, Sports, Food, Politics, and Music
Title: Re: Virtual friend
Post by: Dream of Omnimaga on December 05, 2015, 12:13:09 AM
Can it generate some sentences like Nikkybot or is everything pre-made/based on news feeds?