Skip to content

Commit

Permalink
Fix the list of dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ifreitas committed May 29, 2014
1 parent d5e331a commit e505242
Show file tree
Hide file tree
Showing 14 changed files with 162 additions and 173 deletions.
278 changes: 136 additions & 142 deletions .classpath

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name := "brain"

version := "0.3.1"
version := "0.3.2"

organization := "Israel Freitas"

Expand Down
Binary file not shown.
Binary file removed lib/commons-collections-3.1.jar
Binary file not shown.
Binary file removed lib/javax.servlet-3.0.0.v201112011016.jar
Binary file not shown.
Binary file removed lib/mail-1.4.4.jar
Binary file not shown.
Binary file removed lib/scala-compiler-2.10.0.jar
Binary file not shown.
Binary file removed lib/scala-library.jar
Binary file not shown.
Binary file removed lib/scalap-2.10.0.jar
Binary file not shown.
3 changes: 0 additions & 3 deletions src/main/scala/bootstrap/liftweb/Boot.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ class Boot {
LiftRules.resourceNames = "i18n/messages" :: LiftRules.resourceNames
LiftRules.resourceNames = "props" :: LiftRules.resourceNames

// Brain Config Object
Config.load

createDbUnlessAlreadyExists

}
Expand Down
6 changes: 4 additions & 2 deletions src/main/scala/brain/config/Config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ object Config {
def getGraphDatabasePath = getBrainDataPath+"/databases"
def getKnowledgeBasePath = getBrainDataPath+"/knowledge_base"
def getKnowledgeBaseDir = knowledgeBaseDir
def getProgramDDirPath = getBrainDataPath + "/programd/"
def getProgramDConfPath = getBrainDataPath + "/programd/conf/core.xml"
def getProgramDDirPath = getBrainDataPath + "/programd"
def getProgramDConfPath = getProgramDDirPath + "/conf"
def getProgramDCoreFilePath = getProgramDConfPath + "/core.xml"
def getProgramDOutputPath = getProgramDDirPath + "/output"
}
34 changes: 14 additions & 20 deletions src/main/scala/brain/models/ProgramD.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ object ProgramD {
val programDDir = new File(Config.getProgramDDirPath)
if(!programDDir.exists()){
programDDir.mkdir()
new File(Config.getProgramDDirPath+"/conf").mkdir
new File(Config.getProgramDConfPath).mkdir
new File(Config.getProgramDDirPath+"/output").mkdir
writeFiles
}
}
Expand All @@ -30,7 +31,7 @@ object ProgramD {
def shutdown:Unit= this.core.shutdown
def restart():Unit={
core.shutdown()
core = new Core(core.getBaseURL(), URLTools.contextualize(core.getBaseURL(), Config.getProgramDConfPath));
core = new Core(core.getBaseURL(), URLTools.contextualize(core.getBaseURL(), Config.getProgramDCoreFilePath));
}

private def writeFiles()={
Expand All @@ -45,13 +46,13 @@ object ProgramD {
writeSubstitutions
}
private def writeCore()={
writeFile(Config.getProgramDConfPath, """<?xml version="1.0" encoding="UTF-8"?>
writeFile(Config.getProgramDCoreFilePath, s"""<?xml version="1.0" encoding="UTF-8"?>
<programd xmlns="http://aitools.org/programd/4.7/programd-configuration">
<aiml.namespace-uri>http://alicebot.org/2001/AIML-1.0.1</aiml.namespace-uri>
<paths>
<bot-config>bots.xml</bot-config>
<plugin-config>plugins.xml</plugin-config>
<gossip>file:/var/log/programd/gossip.txt</gossip>
<gossip>file:${Config.getProgramDOutputPath}/gossip.txt</gossip>
</paths>
<predicates>
<empty-default>undefined</empty-default>
Expand All @@ -61,7 +62,7 @@ object ProgramD {
</predicates>
<predicate-manager>
<implementation>org.aitools.programd.predicates.InMemoryPredicateManager</implementation>
<ffpm-dir>file:/var/programd/ffpm</ffpm-dir>
<ffpm-dir>file:${Config.getProgramDOutputPath}/ffpm</ffpm-dir>
</predicate-manager>
<database>
<driver>com.mysql.jdbc.Driver</driver>
Expand Down Expand Up @@ -115,33 +116,26 @@ object ProgramD {
</programd>""")
}
private def writeBots()={
writeFile(Config.getProgramDDirPath+"conf/bots.xml", """<?xml version="1.0" encoding="ISO-8859-1"?>
writeFile(Config.getProgramDConfPath+"/bots.xml", s"""<?xml version="1.0" encoding="UTF-8"?>
<bots xmlns="http://aitools.org/programd/4.7/bot-configuration">
<bot id="Brain Bot" enabled="true">
<properties href="properties.xml"/>
<predicates href="predicates.xml"/>
<substitutions href="substitutions.xml"/>
<sentence-splitters href="sentence-splitters.xml"/>
<listeners href="listeners.xml"/>
<!--
<testing>
<test-suite-path>../resources/testing/AIML.xml</test-suite-path>
<report-directory>../log/programd/test-reports</report-directory>
</testing>
-->
<learn>/Users/israelfreitas/brain/knowledge_base/*.aiml</learn>
<!-- <learn>/tmp/brain/knowledge_base/*.aiml</learn> -->
<learn>${Config.getKnowledgeBasePath}/*.aiml</learn>
</bot>
</bots>""")
}
private def writePlugins()={
writeFile(Config.getProgramDDirPath+"conf/plugins.xml", """<?xml version="1.0" encoding="ISO-8859-1"?>
writeFile(Config.getProgramDConfPath+"/plugins.xml", """<?xml version="1.0" encoding="UTF-8"?>
<plugins xmlns="http://aitools.org/programd/4.7/plugins"
xmlns:d="http://aitools.org/programd/4.7">
</plugins>""")
}
private def writePredicates()={
writeFile(Config.getProgramDDirPath+"conf/predicates.xml", """<?xml version="1.0" encoding="ISO-8859-1"?>
writeFile(Config.getProgramDConfPath+"/predicates.xml", """<?xml version="1.0" encoding="UTF-8"?>
<!--This is an example predicates set definition. Here you can
define default values for predicates, as well as mark those
which are return-name-when-set.-->
Expand All @@ -157,7 +151,7 @@ object ProgramD {
</predicates>""")
}
private def writeProperties()={
writeFile(Config.getProgramDDirPath+"conf/properties.xml", """<?xml version="1.0"?>
writeFile(Config.getProgramDConfPath+"/properties.xml", """<?xml version="1.0"?>
<!-- <properties xmlns="http://aitools.org/programd/4.7/bot-configuration"> -->
<properties>
<!--This is an example properties set definition.-->
Expand Down Expand Up @@ -189,7 +183,7 @@ object ProgramD {
</properties>""")
}
private def writeSentenceSplitters()={
writeFile(Config.getProgramDDirPath+"conf/sentence-splitters.xml", """<?xml version="1.0" encoding="ISO-8859-1"?>
writeFile(Config.getProgramDConfPath+"/sentence-splitters.xml", """<?xml version="1.0" encoding="UTF-8"?>
<!--Sentence splitters define strings that mark the end of a sentence,
after input substitutions have been performed.-->
<sentence-splitters xmlns="http://aitools.org/programd/4.7/bot-configuration">
Expand All @@ -201,7 +195,7 @@ object ProgramD {
</sentence-splitters>""")
}
private def writeSubstitutions()={
writeFile(Config.getProgramDDirPath+"conf/substitutions.xml", """<?xml version="1.0" encoding="ISO-8859-1"?>
writeFile(Config.getProgramDConfPath+"/substitutions.xml", """<?xml version="1.0" encoding="UTF-8"?>
<!--Substitutions are grouped according to several AIML interpreter functions.-->
<substitutions xmlns="http://aitools.org/programd/4.7/bot-configuration">
<!--Input substitutions correct spelling mistakes and convert
Expand Down Expand Up @@ -594,7 +588,7 @@ object ProgramD {
</substitutions>""")
}
private def writeListeners()={
writeFile(Config.getProgramDDirPath+"conf/listeners.xml", """<?xml version="1.0" encoding="ISO-8859-1"?>
writeFile(Config.getProgramDConfPath+"/listeners.xml", """<?xml version="1.0" encoding="UTF-8"?>
<listeners xmlns="http://aitools.org/programd/4.7/bot-configuration"
xmlns:d="http://aitools.org/programd/4.7">
<listener class="org.aitools.programd.listener.AIMListener" enabled="false">
Expand Down
10 changes: 6 additions & 4 deletions src/main/scala/brain/web/WebAppListener.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ import brain.config.Config
class WebAppListener extends ServletContextListener {

def contextInitialized(servletContextEvent:ServletContextEvent) {
//System.setProperty("run.mode", "production")
OrientDbServer.start
//System.setProperty("run.mode", "production")

Config.load

OrientDbServer.start

ProgramD.prepare
val theURL = getBaseURL(servletContextEvent);
println("CORE URL"+ theURL.toString())
val core = new Core(theURL, URLTools.contextualize(theURL, Config.getProgramDConfPath));
val core = new Core(theURL, URLTools.contextualize(theURL, Config.getProgramDCoreFilePath));
ProgramD.start(core);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div id="log" style="overflow-y: scroll;"></div>
<div id="about">
<h2>Brain</h2>
0.3.0
0.3.2
<p>Brain is a tool to model, create and manage the
knowledge base for aiml chaterbots.</p>
<b>Uses:</b>
Expand Down

0 comments on commit e505242

Please sign in to comment.