From 9298539f3f127bbcd080d2871a83de45d3eba460 Mon Sep 17 00:00:00 2001 From: Greg Perry Date: Mon, 23 Aug 2021 07:46:20 -0700 Subject: [PATCH 1/3] removed the crazy license re-write in header - expectation is no header --- pom.xml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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 + + + + + From a7a881894a0b47f59c9c3935f380a546178c0f20 Mon Sep 17 00:00:00 2001 From: Greg Perry Date: Mon, 23 Aug 2021 07:52:17 -0700 Subject: [PATCH 2/3] copyright fix --- src/org/alicebot/ab/Bot.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/alicebot/ab/Bot.java b/src/org/alicebot/ab/Bot.java index 9229d34..a003a90 100644 --- a/src/org/alicebot/ab/Bot.java +++ b/src/org/alicebot/ab/Bot.java @@ -557,7 +557,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"); From 8311ec2c8de991d34e30ae57d76ca3bf2ad0edf8 Mon Sep 17 00:00:00 2001 From: Greg Perry Date: Thu, 26 Aug 2021 11:04:44 -0700 Subject: [PATCH 3/3] removal aimlif and immediate learnf to file --- src/org/alicebot/ab/AIMLProcessor.java | 25 +++++++++++++++++++++++++ src/org/alicebot/ab/Bot.java | 10 ++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) 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 a003a90..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"); @@ -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); + } + }