Permalink
Browse files

tweaks of some parameters

  • Loading branch information...
1 parent ea79662 commit e5d565fc070297bd62c935ae1d515bce1a5dbe40 @Swizec committed Apr 25, 2012
Showing with 5 additions and 4 deletions.
  1. +3 −2 src/Corpus.py
  2. +2 −2 src/chitchat.py
View
@@ -15,6 +15,7 @@ def ngrams(text, l):
class Corpus(UserDict.IterableUserDict):
ngram_len = 1
+ decay = 0.1
def __iter__(self):
return self
@@ -74,7 +75,7 @@ def add_pair(self, current, next):
entry2 = self.__getitem__(next) # for the side-effect
# weaken old connections and drop bad ones
- self.data[key1]['next'] = dict([(k, w-0.1)
+ self.data[key1]['next'] = dict([(k, w-self.decay)
for k, w in self.data[key1]['next'].items()
if w > 0])
@@ -89,7 +90,7 @@ def add_pair(self, current, next):
def add(self, text):
# decrease main weights and drop useless entries
for k in self.data.keys():
- self.data[k]['weight'] -= 0.1
+ self.data[k]['weight'] -= self.decay
if self.data[k]['weight'] < 0:
del self.data[k]
View
@@ -17,8 +17,8 @@ class Chatty(object):
MSGS = 5
# used when deciding whether to speak
- CHATTINESS_LONG = 60
- CHATTINESS_SHORT = 10
+ CHATTINESS_LONG = 30
+ CHATTINESS_SHORT = 5
def __init__(self):
self.buffer = []

0 comments on commit e5d565f

Please sign in to comment.