diff --git a/pom.xml b/pom.xml
index d7522d5..2fe9356 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,18 +63,34 @@
1.1.1
+
+
+ org.slf4j
+ slf4j-api
+ 1.7.21
+
+
+ ch.qos.logback
+ logback-classic
+ 1.0.13
+
+
+
+
+
diff --git a/src/org/alicebot/ab/AIMLProcessor.java b/src/org/alicebot/ab/AIMLProcessor.java
index 9c2467e..c14169f 100644
--- a/src/org/alicebot/ab/AIMLProcessor.java
+++ b/src/org/alicebot/ab/AIMLProcessor.java
@@ -26,6 +26,11 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Locale;
@@ -1226,6 +1231,26 @@ private static String learn(Node node, ParseState ps, Locale locale) { // learn,
// log.info("node is ");
c = new Category(0, pattern, that, "*", template, MagicStrings.learnf_aiml_file);
ps.chatSession.bot.learnfGraph.addCategory(c);
+
+ try {
+ File newCatFile = new File(ps.chatSession.bot.aiml_path + File.separator + MagicStrings.learnf_aiml_file);
+ FileOutputStream fos = null;
+ if (newCatFile.exists()) {
+ fos = new FileOutputStream(newCatFile, true);
+ } else {
+ fos = new FileOutputStream(newCatFile);
+ String header = new String("\n".getBytes(), StandardCharsets.UTF_8);
+ fos.write(header.getBytes());
+ }
+
+ fos.write((Category.categoryToAIML(c) + "\n").getBytes());
+ fos.close();
+ // bw.newLine();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+
}
ps.chatSession.bot.brain.addCategory(c);
// ps.chatSession.bot.brain.printgraph();
diff --git a/src/org/alicebot/ab/Bot.java b/src/org/alicebot/ab/Bot.java
index 9229d34..6c0c234 100644
--- a/src/org/alicebot/ab/Bot.java
+++ b/src/org/alicebot/ab/Bot.java
@@ -48,7 +48,8 @@ public class Bot {
public HashMap setMap = new HashMap();
public HashMap mapMap = new HashMap();
public HashSet pronounSet = new HashSet();
- public String root_path = "c:/ab";
+ // public String root_path = "c:/ab"; // REALLY ? ARE YOU SERIOUS ?
+ public String root_path = "."; // if your not going to set it to null - at least do this
public String bot_path = root_path + "/bots";
public String bot_name_path = bot_path + "/super";
public String aimlif_path = bot_path + "/aimlif";
@@ -366,7 +367,7 @@ public int addCategoriesFromAIMLIF() {
* write all AIML and AIMLIF categories
*/
public void writeQuit() {
- writeAIMLIFFiles();
+ // writeAIMLIFFiles();
// log.info("Wrote AIMLIF Files");
writeAIMLFiles();
// log.info("Wrote AIML Files");
@@ -557,7 +558,7 @@ public void writeAIMLFiles() {
bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fn), StandardCharsets.UTF_8));
fileMap.put(fileName, bw);
bw.write("" + "\n" + "\n");
- bw.write(copyright);
+ // bw.write(copyright);
// bw.newLine();
}
bw.write(Category.categoryToAIML(c) + "\n");
@@ -789,4 +790,9 @@ public void setSraixHandler(SraixHandler sraixHandler) {
public SraixHandler getSraixHandler() {
return sraixHandler;
}
+
+ public String toString() {
+ return String.format("%s - %s", name, root_path);
+ }
+
}