![]() |
|
Chatbot - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Java, JVM, & JRE (https://sinister.li/Forum-Java-JVM-JRE) +--- Thread: Chatbot (/Thread-Chatbot) Pages:
1
2
|
Chatbot - Mediocrity_mybb_import6293 - 10-05-2013 Hello Java Programmers over the last couple hours ive been really bored so i thought about making a program that allows you to speak to the computer and the computer gives you answers depending on your answer but i cant get it to work i need suggestions for the best possible way? Code: /*
I HAVE NO FRIENDS
Purpose; to have a conversation with user
created by Mediocrity
Version (1.0 created 10/05/2013)
*/
import cs1.Keyboard;
public class FootballClub
{
public static void main(String[] args)
{
//this will clear the terminal window
System.out.print('\u000C');
String personsName;
String personsAnswer;
String personsAnswer2;
System.out.println("Hello there what's your name");
personsName = Keyboard.readString();
System.out.println("hello " + personsName);
System.out.println("So " + personsName + " what football team do you support ");
personsAnswer = Keyboard.readString();
if (personsAnswer == "none");
{
System.out.println("Oh im guessing you dont like football then");
System.out.println("Well if you dont like football we can't be friends sorry. BYE!");
}
personsAnswer = Keyboard.readString();
System.out.println("how long have you supported " + personsAnswer);
personsAnswer2 = Keyboard.readString();
System.out.println("Oh WOW " + personsAnswer2 + " that is a long time ");
}
}any help would be grateful
Chatbot - Mediocrity_mybb_import6293 - 10-05-2013 Hello Java Programmers over the last couple hours ive been really bored so i thought about making a program that allows you to speak to the computer and the computer gives you answers depending on your answer but i cant get it to work i need suggestions for the best possible way? Code: /*
I HAVE NO FRIENDS
Purpose; to have a conversation with user
created by Mediocrity
Version (1.0 created 10/05/2013)
*/
import cs1.Keyboard;
public class FootballClub
{
public static void main(String[] args)
{
//this will clear the terminal window
System.out.print('\u000C');
String personsName;
String personsAnswer;
String personsAnswer2;
System.out.println("Hello there what's your name");
personsName = Keyboard.readString();
System.out.println("hello " + personsName);
System.out.println("So " + personsName + " what football team do you support ");
personsAnswer = Keyboard.readString();
if (personsAnswer == "none");
{
System.out.println("Oh im guessing you dont like football then");
System.out.println("Well if you dont like football we can't be friends sorry. BYE!");
}
personsAnswer = Keyboard.readString();
System.out.println("how long have you supported " + personsAnswer);
personsAnswer2 = Keyboard.readString();
System.out.println("Oh WOW " + personsAnswer2 + " that is a long time ");
}
}any help would be grateful
Chatbot - Mediocrity_mybb_import6293 - 10-05-2013 Hello Java Programmers over the last couple hours ive been really bored so i thought about making a program that allows you to speak to the computer and the computer gives you answers depending on your answer but i cant get it to work i need suggestions for the best possible way? Code: /*
I HAVE NO FRIENDS
Purpose; to have a conversation with user
created by Mediocrity
Version (1.0 created 10/05/2013)
*/
import cs1.Keyboard;
public class FootballClub
{
public static void main(String[] args)
{
//this will clear the terminal window
System.out.print('\u000C');
String personsName;
String personsAnswer;
String personsAnswer2;
System.out.println("Hello there what's your name");
personsName = Keyboard.readString();
System.out.println("hello " + personsName);
System.out.println("So " + personsName + " what football team do you support ");
personsAnswer = Keyboard.readString();
if (personsAnswer == "none");
{
System.out.println("Oh im guessing you dont like football then");
System.out.println("Well if you dont like football we can't be friends sorry. BYE!");
}
personsAnswer = Keyboard.readString();
System.out.println("how long have you supported " + personsAnswer);
personsAnswer2 = Keyboard.readString();
System.out.println("Oh WOW " + personsAnswer2 + " that is a long time ");
}
}any help would be grateful
RE: Help Needed! - blackeagle - 10-06-2013 (10-05-2013, 11:44 PM)Mediocrity Wrote: any help would be grateful Code: import java.util.Scanner;
public class FootballClub
{
public static void main(String[] args)
{
//this will clear the terminal window
System.out.print('\u000C');
Scanner in=new Scanner(System.in);
String personsName;
String personsAnswer;
String personsAnswer2;
System.out.println("Hello there what's your name");
personsName = in.nextLine();
System.out.println("hello " + personsName);
System.out.println("So " + personsName + " what football team do you support ");
personsAnswer = in.nextLine();
if (personsAnswer.equals("none"))
{
System.out.println("Oh im guessing you dont like football then");
System.out.println("Well if you dont like football we can't be friends sorry. BYE!");
}
personsAnswer = in.nextLine();
System.out.println("how long have you supported " + personsAnswer);
personsAnswer2 = in.nextLine();
System.out.println("Oh WOW " + personsAnswer2 + " that is a long time ");
}
}RE: Help Needed! - blackeagle - 10-06-2013 (10-05-2013, 11:44 PM)Mediocrity Wrote: any help would be grateful Code: import java.util.Scanner;
public class FootballClub
{
public static void main(String[] args)
{
//this will clear the terminal window
System.out.print('\u000C');
Scanner in=new Scanner(System.in);
String personsName;
String personsAnswer;
String personsAnswer2;
System.out.println("Hello there what's your name");
personsName = in.nextLine();
System.out.println("hello " + personsName);
System.out.println("So " + personsName + " what football team do you support ");
personsAnswer = in.nextLine();
if (personsAnswer.equals("none"))
{
System.out.println("Oh im guessing you dont like football then");
System.out.println("Well if you dont like football we can't be friends sorry. BYE!");
}
personsAnswer = in.nextLine();
System.out.println("how long have you supported " + personsAnswer);
personsAnswer2 = in.nextLine();
System.out.println("Oh WOW " + personsAnswer2 + " that is a long time ");
}
}RE: Help Needed! - blackeagle - 10-06-2013 (10-05-2013, 11:44 PM)Mediocrity Wrote: any help would be grateful Code: import java.util.Scanner;
public class FootballClub
{
public static void main(String[] args)
{
//this will clear the terminal window
System.out.print('\u000C');
Scanner in=new Scanner(System.in);
String personsName;
String personsAnswer;
String personsAnswer2;
System.out.println("Hello there what's your name");
personsName = in.nextLine();
System.out.println("hello " + personsName);
System.out.println("So " + personsName + " what football team do you support ");
personsAnswer = in.nextLine();
if (personsAnswer.equals("none"))
{
System.out.println("Oh im guessing you dont like football then");
System.out.println("Well if you dont like football we can't be friends sorry. BYE!");
}
personsAnswer = in.nextLine();
System.out.println("how long have you supported " + personsAnswer);
personsAnswer2 = in.nextLine();
System.out.println("Oh WOW " + personsAnswer2 + " that is a long time ");
}
}RE: Help Needed! - Deque - 10-06-2013 This is not an easy task. There are competitions and there is even an award (Loebner Prize) for the creation of programs that are able to answer like a human would. But for the beginning it will be enough to do it like ELIZA: https://en.wikipedia.org/wiki/ELIZA Her implementation is simple and you will realize that she has no memory of what you told here after a while of chatting. Here is site where you can try chatting with her: http://nlp-addiction.com/eliza/ Also interesting: http://alicebot.blogspot.de/ For more bots look at this article: https://en.wikipedia.org/wiki/Chatterbot Also NLP (Natural Language Processing) is an interesting topic for you, if you want to get deeper into it: https://en.wikipedia.org/wiki/Computational_linguistics RE: Help Needed! - Deque - 10-06-2013 This is not an easy task. There are competitions and there is even an award (Loebner Prize) for the creation of programs that are able to answer like a human would. But for the beginning it will be enough to do it like ELIZA: https://en.wikipedia.org/wiki/ELIZA Her implementation is simple and you will realize that she has no memory of what you told here after a while of chatting. Here is site where you can try chatting with her: http://nlp-addiction.com/eliza/ Also interesting: http://alicebot.blogspot.de/ For more bots look at this article: https://en.wikipedia.org/wiki/Chatterbot Also NLP (Natural Language Processing) is an interesting topic for you, if you want to get deeper into it: https://en.wikipedia.org/wiki/Computational_linguistics RE: Help Needed! - Deque - 10-06-2013 This is not an easy task. There are competitions and there is even an award (Loebner Prize) for the creation of programs that are able to answer like a human would. But for the beginning it will be enough to do it like ELIZA: https://en.wikipedia.org/wiki/ELIZA Her implementation is simple and you will realize that she has no memory of what you told here after a while of chatting. Here is site where you can try chatting with her: http://nlp-addiction.com/eliza/ Also interesting: http://alicebot.blogspot.de/ For more bots look at this article: https://en.wikipedia.org/wiki/Chatterbot Also NLP (Natural Language Processing) is an interesting topic for you, if you want to get deeper into it: https://en.wikipedia.org/wiki/Computational_linguistics RE: Chatbot - blackeagle - 10-06-2013 thanks for the +rep @Mediocrity
|