Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,534 members, 7,819,915 topics. Date: Tuesday, 07 May 2024 at 06:32 AM

I Want To Create An AI (artificial Intelligence) With Java - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / I Want To Create An AI (artificial Intelligence) With Java (2232 Views)

Can You Create An Ai Chatbot That Can Speak Nigerian Pidgin? / Artificial Intelligence And Machine Learning Group / Learning To Program With Java by the Fulaman (2) (3) (4)

(1) (Reply) (Go Down)

I Want To Create An AI (artificial Intelligence) With Java by willace(m): 8:31am On Mar 27, 2016
Am currently learning java and i want to create an AI like a virtual Secretary.
Any ideas please
Re: I Want To Create An AI (artificial Intelligence) With Java by techthought: 9:58am On Mar 27, 2016
I wish you luck man. You may want to check out big data. I think it is a more useful skill.
Re: I Want To Create An AI (artificial Intelligence) With Java by osarenomaspecial: 11:06am On Mar 27, 2016
good one
Re: I Want To Create An AI (artificial Intelligence) With Java by Celebrimbor(m): 12:15pm On Mar 27, 2016
Well well...... let me be realistic... you can't do it.

1 Like

Re: I Want To Create An AI (artificial Intelligence) With Java by techthought: 1:49pm On Mar 27, 2016
Celebrimbor:
Well well...... let me be realistic... you can't do it.

Be optimistic man. Don't be so negative. No offense.
Re: I Want To Create An AI (artificial Intelligence) With Java by willace(m): 1:59pm On Mar 27, 2016
Celebrimbor:
Well well...... let me be realistic... you can't do it.

Y do u say dat, someone already did it so y can't i.
It takes just belief and hardwork.
My friend dont limit ur mind 2 thinking small. Peace
Re: I Want To Create An AI (artificial Intelligence) With Java by Celebrimbor(m): 2:05pm On Mar 27, 2016
techthought:


Be optimistic man. Don't be so negative. No offense.
balance optimism with realism bro. if he had said that he was gonna build an operating system from scratch, I would have said sure go for it. But an AI is a whole new level. No negativity but this is a white elephant project...... for a single programmer.
Re: I Want To Create An AI (artificial Intelligence) With Java by Celebrimbor(m): 2:13pm On Mar 27, 2016
willace:


Y do u say dat, someone already did it so y can't i.
It takes just belief and hardwork.
My friend dont limit ur mind 2 thinking small. Peace
hahahahahah..... bros firstly I would like to ask who did it. secondly I would like to say everything has a cost.... do you know what it would cost you to come up with an AI? are you ready to pay it? if you are ready and willing fine fire down and pray you make a breakthrough..... but you can channel that same energy to solve a problem that is more important, valuable and immediate than an AI..... my opinion tho
Re: I Want To Create An AI (artificial Intelligence) With Java by Celebrimbor(m): 2:14pm On Mar 27, 2016
Please note "A single programmer"
Re: I Want To Create An AI (artificial Intelligence) With Java by willace(m): 2:23pm On Mar 27, 2016
Celebrimbor:
balance optimism with realism bro. if he had said that he was gonna build an operating system from scratch, I would have said sure go for it. But an AI is a whole new level. No negativity but this is a white elephant project...... for a single programmer.

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;

import java.awt.Color;

import java.awt.event.KeyListener;
import java.awt.event.KeyEvent;

import java.lang.Math;

public class ChatBot extends JFrame implements KeyListener{

JPanel p=new JPanel();
JTextArea dialog=new JTextArea(20,50);
JTextArea input=new JTextArea(1,50);
JScrollPane scroll=new JScrollPane(
dialog,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER
);

String[][] chatBot={
//standard greetings
{"hi","hello","hola","ola","howdy"},
{"hi","hello","hey"},
//question greetings
{"how are you","how r you","how r u","how are u"},
{"good","doing well"},
//yes
{"yes"},
{"no","NO","NO!!!!!!!"},
//default
{"shut up","you're bad","noob","stop talking",
"(michael is unavailable, due to LOL)"}
};

public static void main(String[] args){
new ChatBot();
}

public ChatBot(){
super("Chat Bot"wink;
setSize(600,400);
setResizable(false);
setDefaultCloseOperation(EXIT_ON_CLOSE);

dialog.setEditable(false);
input.addKeyListener(this);

p.add(scroll);
p.add(input);
p.setBackground(new Color(255,200,0));
add(p);

setVisible(true);
}

public void keyPressed(KeyEvent e){
if(e.getKeyCode()==KeyEvent.VK_ENTER){
input.setEditable(false);
//-----grab quote-----------
String quote=input.getText();
input.setText(""wink;
addText("-->You:\t"+quote);
quote.trim();
while(
quote.charAt(quote.length()-1)=='!' ||
quote.charAt(quote.length()-1)=='.' ||
quote.charAt(quote.length()-1)=='?'
){
quote=quote.substring(0,quote.length()-1);
}
quote.trim();
byte response=0;
/*
0:we're searching through chatBot[][] for matches
1:we didn't find anything
2:we did find something
*/
//-----check for matches----
int j=0;//which group we're checking
while(response==0){
if(inArray(quote.toLowerCase(),chatBot[j*2])){
response=2;
int r=(int)Math.floor(Math.random()*chatBot[(j*2)+1].length);
addText("\n-->Michael\t"+chatBot[(j*2)+1][r]);
}
j++;
if(j*2==chatBot.length-1 && response==0){
response=1;
}
}

//-----default--------------
if(response==1){
int r=(int)Math.floor(Math.random()*chatBot[chatBot.length-1].length);
addText("\n-->Michael\t"+chatBot[chatBot.length-1][r]);
}
addText("\n"wink;
}
}

public void keyReleased(KeyEvent e){
if(e.getKeyCode()==KeyEvent.VK_ENTER){
input.setEditable(true);
}
}

public void keyTyped(KeyEvent e){}

public void addText(String str){
dialog.setText(dialog.getText()+str);
}

public boolean inArray(String in,String[] str){
boolean match=false;
for(int i=0;i<str.length;i++){
if(str[i].equals(in)){
match=true;
}
}
return match;
}
}


Bros that is a source code for a chat bot i created . an AI follows the same process but a littlé bit advance. So it is possible my brother
Re: I Want To Create An AI (artificial Intelligence) With Java by Celebrimbor(m): 2:29pm On Mar 27, 2016
willace:


import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;

import java.awt.Color;

import java.awt.event.KeyListener;
import java.awt.event.KeyEvent;

import java.lang.Math;

public class ChatBot extends JFrame implements KeyListener{

JPanel p=new JPanel();
JTextArea dialog=new JTextArea(20,50);
JTextArea input=new JTextArea(1,50);
JScrollPane scroll=new JScrollPane(
dialog,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER
);

String[][] chatBot={
//standard greetings
{"hi","hello","hola","ola","howdy"},
{"hi","hello","hey"},
//question greetings
{"how are you","how r you","how r u","how are u"},
{"good","doing well"},
//yes
{"yes"},
{"no","NO","NO!!!!!!!"},
//default
{"shut up","you're bad","noob","stop talking",
"(michael is unavailable, due to LOL)"}
};

public static void main(String[] args){
new ChatBot();
}

public ChatBot(){
super("Chat Bot"wink;
setSize(600,400);
setResizable(false);
setDefaultCloseOperation(EXIT_ON_CLOSE);

dialog.setEditable(false);
input.addKeyListener(this);

p.add(scroll);
p.add(input);
p.setBackground(new Color(255,200,0));
add(p);

setVisible(true);
}

public void keyPressed(KeyEvent e){
if(e.getKeyCode()==KeyEvent.VK_ENTER){
input.setEditable(false);
//-----grab quote-----------
String quote=input.getText();
input.setText(""wink;
addText("-->You:\t"+quote);
quote.trim();
while(
quote.charAt(quote.length()-1)=='!' ||
quote.charAt(quote.length()-1)=='.' ||
quote.charAt(quote.length()-1)=='?'
){
quote=quote.substring(0,quote.length()-1);
}
quote.trim();
byte response=0;
/*
0:we're searching through chatBot[][] for matches
1:we didn't find anything
2:we did find something
*/
//-----check for matches----
int j=0;//which group we're checking
while(response==0){
if(inArray(quote.toLowerCase(),chatBot[j*2])){
response=2;
int r=(int)Math.floor(Math.random()*chatBot[(j*2)+1].length);
addText("\n-->Michael\t"+chatBot[(j*2)+1][r]);
}
j++;
if(j*2==chatBot.length-1 && response==0){
response=1;
}
}

//-----default--------------
if(response==1){
int r=(int)Math.floor(Math.random()*chatBot[chatBot.length-1].length);
addText("\n-->Michael\t"+chatBot[chatBot.length-1][r]);
}
addText("\n"wink;
}
}

public void keyReleased(KeyEvent e){
if(e.getKeyCode()==KeyEvent.VK_ENTER){
input.setEditable(true);
}
}

public void keyTyped(KeyEvent e){}

public void addText(String str){
dialog.setText(dialog.getText()+str);
}

public boolean inArray(String in,String[] str){
boolean match=false;
for(int i=0;i<str.length;i++){
if(str[i].equals(in)){
match=true;
}
}
return match;
}
}


Bros that is a source code for a chat bot i created . an AI follows the same process but a littlé bit advance. So it is possible my brother
Sorry to burst your bubble but I don't think you know what artificial intelligence is. Anyway Don't let me stop you. I am just being realistic and honest with you. Do your research and know what you are getting into before you do it. DONT ASSUME!!!
Re: I Want To Create An AI (artificial Intelligence) With Java by Djade007: 2:30pm On Mar 27, 2016
Celebrimbor:
Sorry to burst your bubble but I don't think you know what artificial intelligence is. Anyway Don't let me stop you. I am just being realistic and honest with you. Do your research and know what you are getting into before you do it. DONT ASSUME!!!

Why don't you teach us. How else does ai works?
Re: I Want To Create An AI (artificial Intelligence) With Java by willace(m): 2:31pm On Mar 27, 2016
Celebrimbor:
Sorry to burst your bubble but I don't think you know what artificial intelligence is. Anyway Don't let me stop you. I am just being realistic and honest with you. Do your research and know what you are getting into before you do it. DONT ASSUME!!!

Thanks tho
Re: I Want To Create An AI (artificial Intelligence) With Java by Celebrimbor(m): 2:32pm On Mar 27, 2016
Recently Google designed an artificial intelligence that played and won a game of Go against one of the highest ranking players. The artificial intelligence ran on computer cluster with more than 300 processor cores. For a game of Go only. yours is a secretary AI. try factoring that into your dream.
Re: I Want To Create An AI (artificial Intelligence) With Java by Djade007: 2:34pm On Mar 27, 2016
@Willace I'm guessing its something similar to that, look at ALICE bot
http://www.alicebot.org

Currently my whatsapp bot uses an algorithm like what you have, it was built with php. https://www.nairaland.com/2936138/how-install-sbot-whatsapp-group
Re: I Want To Create An AI (artificial Intelligence) With Java by willace(m): 3:08pm On Mar 27, 2016
Djade007:
@Wallace I'm guessing its something similar to that, look at ALICE bot
http://www.alicebot.org/aiml.html

Currently my whatsapp bot uses an algorithm like what you have, it was built with php. https://www.nairaland.com/2936138/how-install-sbot-whatsapp-group

Am looking at a virtual secretary that can be used by a company to acess information from their database. For example if the company needs to employ and the virtual secretary is asked "which area of the company needs recruiting" virtual secretary will now give you an answer based on the information gotten from the company database
Or when the virtual secretary is asked "what ist oday's date" it would look at tge word "date"and search through an array. And it would be able to use the keyword" search" to search through Google for answers
Re: I Want To Create An AI (artificial Intelligence) With Java by willace(m): 3:10pm On Mar 27, 2016
Celebrimbor:
Recently Google designed an artificial intelligence that played and won a game of Go against one of the highest ranking players. The artificial intelligence ran on computer cluster with more than 300 processor cores. For a game of Go only. yours is a secretary AI. try factoring that into your dream.

Bros am not taliking about an AI like Gideon in flash or JARVIS in ironman. Am just talking about a simple software that has artificial intelligence
Re: I Want To Create An AI (artificial Intelligence) With Java by larisoft: 5:13pm On Mar 27, 2016
Celebrimbor:
hahahahahah..... bros firstly I would like to ask who did it. secondly I would like to say everything has a cost.... do you know what it would cost you to come up with an AI? are you ready to pay it? if you are ready and willing fine fire down and pray you make a breakthrough..... but you can channel that same energy to solve a problem that is more important, valuable and immediate than an AI..... my opinion tho

an AI you call it? Are you aware that an ordinary chatbot that has a series of conversation lines to exchange with a user, depending on input, is actually using artificial intelligence? Are you aware that a music player that makes patterns off your listening habits and plays the songs you like when you like it utilizes artificial intelligence?

Bro, we are all learning; but if you dont know a thing, do not discourage a person from doing it.

@OP, you can definitely do it! you will just need a lot of data...not monstrous at all...just so your app will have a wide range of responses to different scenarios. God's speed.
Re: I Want To Create An AI (artificial Intelligence) With Java by Nobody: 5:17pm On Mar 27, 2016
create a virtual machine that that works with various OS . coding alone may not be the answer .
Re: I Want To Create An AI (artificial Intelligence) With Java by techthought: 9:14pm On Mar 27, 2016
Celebrimbor:
balance optimism with realism bro. if he had said that he was gonna build an operating system from scratch, I would have said sure go for it. But an AI is a whole new level. No negativity but this is a white elephant project...... for a single programmer.

You have got a point bro, all I am saying is tone down a little bit. Nothing is impossible.

(1) (Reply)

Full Naijaloaded And Nairaland Codes / Elvis Chidera, Village boy now a Global Programmer / Progress Report: Becoming A Data Analyst

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 45
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.