otp: Remove case sensitivity, durr.

This commit is contained in:
Cosmos 2014-08-02 21:34:48 +03:00
parent 53c9f75f90
commit e9b46f8391
2 changed files with 3 additions and 2 deletions

View file

@ -119,7 +119,7 @@ class ChatAgentUD(DistributedObjectGlobalUD):
offset = 0
words = message.split()
for wordit in xrange(len(words)):
word = words[wordit]
word = words[wordit].lower()
seqlist = self.sequenceList.getList(word)
if len(seqlist) > 0:
for seqit in xrange(len(seqlist)):
@ -128,6 +128,7 @@ class ChatAgentUD(DistributedObjectGlobalUD):
if len(words) - (wordit + 1) >= len(splitseq):
cmplist = words[wordit + 1:]
del cmplist[len(splitseq):]
cmplist = [word.lower() for word in cmplist]
if cmp(cmplist, splitseq) == 0:
modifications.append((offset, offset + len(word) + len(sequence) - 1))
offset += len(word) + 1

View file

@ -4,7 +4,7 @@ class SequenceList:
self.list = {}
for line in wordlist.split():
split = line.split(':')
self.list[split[0]] = [word.rstrip('\r\n') for word in split[1].split(',')]
self.list[split[0].lower()] = [word.rstrip('\r\n').lower() for word in split[1].split(',')]
def getList(self, word):
if word in self.list:
return self.list[word]