mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 06:59:53 -05:00
counts
This commit is contained in:
parent
2c11473946
commit
6920c7db1b
@ -26,8 +26,8 @@ class SpiceBot_AI():
|
|||||||
self.setup_ai()
|
self.setup_ai()
|
||||||
self.braindirs = []
|
self.braindirs = []
|
||||||
self.dict = {
|
self.dict = {
|
||||||
"counts": 0,
|
"patterncount": 0,
|
||||||
"failcounts": 0,
|
"filecounts": 0,
|
||||||
"sessioncache": {},
|
"sessioncache": {},
|
||||||
"files": {}
|
"files": {}
|
||||||
}
|
}
|
||||||
@ -94,6 +94,16 @@ class SpiceBot_AI():
|
|||||||
for braindir in braindirs:
|
for braindir in braindirs:
|
||||||
if braindir not in self.braindirs:
|
if braindir not in self.braindirs:
|
||||||
self.braindirs.append(braindir)
|
self.braindirs.append(braindir)
|
||||||
|
|
||||||
|
# Count matches
|
||||||
|
for pathname in os.listdir(braindir):
|
||||||
|
self.dict["filecounts"] += 1
|
||||||
|
aimlfile = os.path.join(braindir, pathname)
|
||||||
|
data = open(aimlfile).read()
|
||||||
|
count = data.count('pattern')
|
||||||
|
count = count / 2
|
||||||
|
self.dict["patterncount"] += count
|
||||||
|
|
||||||
tempbrain = tempfile.mkstemp()[1]
|
tempbrain = tempfile.mkstemp()[1]
|
||||||
with open(tempbrain, 'w') as fileo:
|
with open(tempbrain, 'w') as fileo:
|
||||||
fileo.write(
|
fileo.write(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user