|
|
Member
Total posts: 15
Joined: Mar 4, 2014
|
when using the ab.jar in eclipse I get the following error when trying to run the bot.
“Could not find class ‘org.alicebot.ab.Bot’, referenced from method…”. The chat class is being imported but the bot class cannot be imported.
Here is my code:
import org.alicebot.ab.Bot; import org.alicebot.ab.Chat;
import android.annotation.SuppressLint; import android.app.ActionBar.LayoutParams; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.ViewTreeObserver; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.TextView;
public class MainActivity extends Activity {
String usertext; String response; String botname="MAVIS"; Bot mavis=new Bot(botname); Chat chat= new Chat(mavis);
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final LinearLayout ll1 = (LinearLayout) findViewById(R.id.ll1); final LinearLayout ll2 = (LinearLayout) findViewById(R.id.ll2); final ScrollView scv = (ScrollView) findViewById(R.id.sv); final Button btn = (Button) findViewById(R.id.button1); final EditText medit = (EditText) findViewById(R.id.editText1);
btn.setOnClickListener(new View.OnClickListener() {
@SuppressLint("NewApi") @Override public void onClick(View v) {
TextView tvu=new TextView(v.getContext()); TextView tvb=new TextView(v.getContext());
TextView tvut=new TextView(v.getContext()); TextView tvbt=new TextView(v.getContext());
TextView tvdivider1=new TextView(v.getContext()); TextView tvdivider2=new TextView(v.getContext());
final LayoutParams lparams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
tvu.setLayoutParams(lparams); tvb.setLayoutParams(lparams);
tvut.setLayoutParams(lparams); tvbt.setLayoutParams(lparams);
tvdivider1.setLayoutParams(lparams); tvdivider2.setLayoutParams(lparams);
usertext = medit.getText().toString(); if(usertext.trim().length() != 0){
ll1.addView(tvu); ll1.addView(tvb); ll2.addView(tvut); ll2.addView(tvbt); ll1.addView(tvdivider1); ll2.addView(tvdivider2);
response=chat.multisentenceRespond(usertext);
tvu.setText("User"); tvb.setText(botname);
tvbt.setText(" : "+ response); tvut.setText(" : "+ usertext); medit.setText(" ");
tvdivider1.setText(" "); tvdivider2.setText(" --------------------"); } else{ //do nothing } } });
scv.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { public void onGlobalLayout() { scv.post(new Runnable() { public void run() { scv.fullScroll(View.FOCUS_DOWN); } }); } }); }
}
I have imported the external library and defined the classpath for it. I have also copied the ab.jar in my project folder and even defined the classpath for it. But nothing seems to be working. Am I doing this wrong or are there more libraries that are needed for this to work. Anybody have a solution to my problem?
|
|
|
|
|
Posted: Mar 28, 2014 |
[ # 1 ]
|
|
Guru
Total posts: 1297
Joined: Nov 3, 2009
|
The first place I would look is here…
else{ //do nothing }
|
|
|
|
|
Posted: Mar 30, 2014 |
[ # 2 ]
|
|
Member
Total posts: 15
Joined: Mar 4, 2014
|
∞Pla•Net - Mar 28, 2014: The first place I would look is here…
else{ //do nothing }
i replaced the if/else with while. Same problem
|
|
|
|
|
Posted: Mar 30, 2014 |
[ # 3 ]
|
|
Administrator
Total posts: 3111
Joined: Jun 14, 2010
|
I would change it back to if/else and put some sort of diagnostic code inside the else block, just to see if that’s where it’s failing. Probably something like displaying the contents of the variable usertext, to make sure that it’s not coming in as an empty string (which is what it seems to be doing).
|
|
|
|
|
Posted: Mar 30, 2014 |
[ # 4 ]
|
|
Guru
Total posts: 1297
Joined: Nov 3, 2009
|
I would try what Dave just said.
Then, at the top, I would try adding something like…
package org.alicebot.ab;
Or, maybe the CLASSPATH is not set, so Java can’t find org.alicebot.ab.*
|
|
|
|
|
Posted: Mar 30, 2014 |
[ # 5 ]
|
|
Member
Total posts: 15
Joined: Mar 4, 2014
|
∞Pla•Net - Mar 30, 2014: I would try what Dave just said.
Then, at the top, I would try adding something like…
package org.alicebot.ab;
Or, maybe the CLASSPATH is not set, so Java can’t find org.alicebot.ab.*
I tried what dave suggested. The app won’t even start. I’ve already set the classpath but the same error is coming up. I’ve checked the .classpath file in my project and the path for the library is there. The package is defined at the as
package com.example.test3;
|
|
|
|
|
Posted: Mar 30, 2014 |
[ # 6 ]
|
|
Guru
Total posts: 1297
Joined: Nov 3, 2009
|
Ishwor said, “I tried what dave suggested. The app won’t even start.”
If the fact that it won’t even start, is a change from what it was doing before, then Dave’s advice was good for troubleshooting purposes. At least you know now that when you take Dave’s suggestion, something different happens.
For one thing, the syntax error “Could not find class ‘org.alicebot.ab.Bot’, referenced from method…” disappeared, correct? If so, that may be a hint to solving this issue, or a section of source code that may be cleaned up a bit.
What’s “package com.example.test3;”? If for comparison “package org.alicebot.ab;” equates to http://ab.alicebot.org then “package com.example.test3;” equates to http://test3.example.com. It looks like that may be ALPHA code syntax used as a guide that was supposed to be cleaned up.
Presuming you are on Windows, what do you see when you type this at the command line?
echo %CLASSPATH%
|
|
|
|
|
Posted: Mar 30, 2014 |
[ # 7 ]
|
|
Member
Total posts: 15
Joined: Mar 4, 2014
|
∞Pla•Net - Mar 30, 2014: Ishwor said, “I tried what dave suggested. The app won’t even start.”
If the fact that it won’t even start, is a change from what it was doing before, then Dave’s advice was good for troubleshooting purposes. At least you know now that when you take Dave’s suggestion, something different happens.
For one thing, the syntax error “Could not find class ‘org.alicebot.ab.Bot’, referenced from method…” disappeared, correct? If so, that may be a hint to solving this issue, or a section of source code that may be cleaned up a bit.
What’s “package com.example.test3;”? If for comparison “package org.alicebot.ab;” equates to http://ab.alicebot.org then “package com.example.test3;” equates to http://test3.example.com. It looks like that may be ALPHA code syntax used as a guide that was supposed to be cleaned up.
Presuming you are on Windows, what do you see when you type this at the command line?
echo %CLASSPATH%
I should have worded that reply better. The app hadn’t started before and currently has the same problem. The error didn’t disappear, it is still showing. I forgot to mention that.
I’m using eclipse and when starting a new project eclipse automatically defines the package for us.
I used that code as it was given in the program ab documentation. Since it was for java I thought it would work for android as well. Perhaps I am doing something wrong here. Can anyone knowledgeable in android check out program ab.
|
|
|
|
|
Posted: Mar 30, 2014 |
[ # 8 ]
|
|
Guru
Total posts: 1297
Joined: Nov 3, 2009
|
8 Step Tutorial: Running Program AB on Ubuntu Linux 12.10 64bit
1. Goto: https://code.google.com/p/program-ab/wiki/RunningAB
2. Download link “program-ab.zip”: https://code.google.com/p/program-ab/downloads/detail?name=program-ab.zip
3. Make Directory for download: mkdir ~/programAB
4. Change Directory to download directory: cd ~/programAB
5. Extract “program-ab.zip” inside download directory ~/programAB
6. Create shell script “run.sh” with text editor inside download directory ~/programAB
#/bin/bash
/usr/bin/java -cp out/production/Ab Main bot=super action=chat trace=false
6. Make shell script executable with: chmod +x run.sh
7. Run Program AB with: ./run.sh
8. Please suggest improvements to this tutorial. For now, you should see something like this ...
Working Directory = ~/programAB
Program AB 0.0.3.3 beta—AI Foundation Reference AIML 2.0 implementation
bot=super
action=chat
trace=false
trace mode = false
Name = super Path = ~/programAB/bots/super
~/programAB
~/programAB/bots
~/programAB/bots/super
~/programAB/bots/super/aiml
~/programAB/bots/super/aimlif
~/programAB/bots/super/config
~/programAB/bots/super/logs
~/programAB/bots/super/sets
~/programAB/bots/super/maps
Preprocessor: 416 norms 56 persons 9 person2
Get Properties: ~/programAB/bots/super/config/properties.txt
Exists: ~/programAB/bots/super/config/properties.txt
Loading AIML Sets files from ~/programAB/bots/super/sets
digit.txt
Read AIML Set digit
Reading AIML Set ~/programAB/bots/super/sets/digit.txt
verb2st.txt
Read AIML Set verb2st
Reading AIML Set ~/programAB/bots/super/sets/verb2st.txt
preposition.txt
Read AIML Set preposition
Reading AIML Set ~/programAB/bots/super/sets/preposition.txt
fastfood.txt
Read AIML Set fastfood
Reading AIML Set ~/programAB/bots/super/sets/fastfood.txt
verb2sp.txt
Read AIML Set verb2sp
Reading AIML Set ~/programAB/bots/super/sets/verb2sp.txt
place.txt
Read AIML Set place
Reading AIML Set ~/programAB/bots/super/sets/place.txt
name.txt
Read AIML Set name
Reading AIML Set ~/programAB/bots/super/sets/name.txt
familiarname.txt
Read AIML Set familiarname
Reading AIML Set ~/programAB/bots/super/sets/familiarname.txt
ordinal.txt
Read AIML Set ordinal
Reading AIML Set ~/programAB/bots/super/sets/ordinal.txt
color.txt
Read AIML Set color
Reading AIML Set ~/programAB/bots/super/sets/color.txt
Loading AIML Map files from ~/programAB/bots/super/maps
number2ordinal.txt
Read AIML Map number2ordinal
Reading AIML Map ~/programAB/bots/super/maps/number2ordinal.txt
verb2sp2verb1sp.txt
Read AIML Map verb2sp2verb1sp
Reading AIML Map ~/programAB/bots/super/maps/verb2sp2verb1sp.txt
familiarpredicate.txt
Read AIML Map familiarpredicate
Reading AIML Map ~/programAB/bots/super/maps/familiarpredicate.txt
ordinal2number.txt
Read AIML Map ordinal2number
Reading AIML Map ~/programAB/bots/super/maps/ordinal2number.txt
gendername.txt
Read AIML Map gendername
Reading AIML Map ~/programAB/bots/super/maps/gendername.txt
AIML modified Sun Mar 30 10:33:34 EDT 2014 AIMLIF modified Sun Mar 30 10:33:34 EDT 2014
No deleted.aiml.csv file found
readCertainIFCategories 811 categories from unfinished.aiml.csv
Loading AIML files from ~/programAB/bots/super/aimlif
Loaded 4736 categories in 0.366 sec —> Bot super 4736 completed 0 deleted 811 unfinished
9354 nodes 7913 singletons 89 leaves 4647 shortcuts 1352 n-ary 13993 branches 1.4959376 average branching
Human: Hello
Robot: Hi! It’s delightful to see you.
Human: What is your name?
Robot: Call me SUPER.
Human:
NO WARRANTY
THE TUTORIAL IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL AS AN EXAMPLE FOR LEARNING, FOR DISCUSSION PURPOSES ONLY, BUT WITHOUT ANY WARRANTY. IT IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE TUTORIAL IS WITH YOU. SHOULD THE TUTORIAL PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW THE AUTHOR WILL BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE TUTORIAL (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE TUTORIAL TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
|
|
|
Posted: Mar 30, 2014 |
[ # 9 ]
|
|
Member
Total posts: 15
Joined: Mar 4, 2014
|
|
|
|
|
|
Posted: Mar 30, 2014 |
[ # 10 ]
|
|
Guru
Total posts: 1297
Joined: Nov 3, 2009
|
Ishwor,
I’m installing Eclipse now on Ubuntu Linux.
Then, I’ll take a look at the Android SDK which includes a mobile device emulator.
This may turn out to be a fun educational hobby to try to solve this issue the hard way.
Yet, I think most readers may enjoy the new CallMom app for Android
as the much easier option… https://play.google.com/store/apps/details?id=com.pandorabots.callmom
In my honest opinion as a hobbyist, it is important to support A.I. companies in our chatbot community.
|
|
|
|
|
Posted: Mar 30, 2014 |
[ # 11 ]
|
|
Member
Total posts: 15
Joined: Mar 4, 2014
|
∞Pla•Net - Mar 30, 2014: Ishwor,
I’m installing Eclipse now on Ubuntu Linux.
Then, I’ll take a look at the Android SDK which includes a mobile device emulator.
This may turn out to be a fun educational hobby to try to solve this issue the hard way.
Yet, I think most readers may enjoy the new CallMom app for Android
as the much easier option… https://play.google.com/store/apps/details?id=com.pandorabots.callmom
In my honest opinion as a hobbyist, it is important to support A.I. companies in our chatbot community.
Thank you very much I appreciate your help. I am developing this chatbot for an academic project so that is why I am not using callmom. Maybe after this project I can look into it.
|
|
|
|
|
Posted: Mar 30, 2014 |
[ # 12 ]
|
|
Administrator
Total posts: 3111
Joined: Jun 14, 2010
|
Sadly I’m away from my work computer for another week and a half, and the laptop I have with me isn’t suited for testing this problem, so I’m going to leave the assisting in 8Pla’s capable hands. Sorry I can’t be more helpful right now. Ill be back from my trip to England on the 10th of April, and back to work on the 11th, so we’ll see at that point, but I think this will be solved by then.
|
|
|
|
|
Posted: Mar 31, 2014 |
[ # 13 ]
|
|
Guru
Total posts: 1297
Joined: Nov 3, 2009
|
I downloaded and setup the ADT Bundle from:
http://developer.android.com/sdk/installing/bundle.html
And, on the site it claims… That’s it! The IDE is already loaded with the Android Developer Tools plugin and the SDK is ready to go.
However, their own demo project loaded in the IDE is not ready to go, since it fails with error:
Your project contains error(s), please fix them before running your application.
Funny, they try to blame my project in the error!
I don’t even have a project, yet.
So, their error should put the blame on them:
Our own demo project contains error(s), that we didn’t fix, so our demo failed.
|
|
|
|
|
Posted: Apr 1, 2014 |
[ # 14 ]
|
|
Member
Total posts: 8
Joined: Mar 31, 2014
|
hi Ishwor,
I am vijay vankhede. We have talk about this error at program-ab issue-5. I am also developing chat bot android application for my final year project. I think we have to look at program-o which is aiml php interpreter. We can build chat bot based on client server architecture unless embed aiml app.
|
|
|
|
|
Posted: Apr 1, 2014 |
[ # 15 ]
|
|
Member
Total posts: 15
Joined: Mar 4, 2014
|
Vijay S.Vankhede - Apr 1, 2014: hi Ishwor,
I am vijay vankhede. We have talk about this error at program-ab issue-5. I am also developing chat bot android application for my final year project. I think we have to look at program-o which is aiml php interpreter. We can build chat bot based on client server architecture unless embed aiml app.
I have no problem moving to program O but can we use that in android? I don’t want to look into program O unless its fruitful.
|
|
|
|