Exemplo n.º 1
0
    def __init__(self, name):
        from curtana.lib.parser_aliases import RE, R
        B.Base.__init__(self, ApiMod.from_name(name))
        vocab.Vocabulary.__init__(self)
        
        self.screen_name = name
        self.talked = []
        self.assoc_table = Counter()
        self.markov_table = G.Table()
        self.load(B.PATH)

        self.pattern = (RE("もしゃもしゃ|モシャモシャ|もふもふ|モフモフ") >> R(self.response0)
                        | RE("(^|む|[^く])ぎゅ[っうぅー]?") >> R(self.response1)
                        | RE("なでなで|ナデナデ") >> R(self.response2)
                        | RE("ぺろぺろ|ペロペロ|ちゅっちゅ|チュッチュ") >> R(self.response3) 
                        )
        self.voluntary = (RE("((^|[^ァ-ヾ])リサ|(^|[^ぁ-ゞ])りさ)(ちゃん|チャン)")
                         >> R(compose(star(OP.rshift), fanout(self.chan_ha_fuyou, self.favorite)))
                         #|RE("((^|[^ァ-ヾ])リサ|^りさ)") >> R(self.favorite)
                         )
Exemplo n.º 2
0
import cPickle
import re
import datetime
import operator as OP
import random

from itertools import imap
from functools import partial
from collections import Counter

import lisabot3.lisa.generator as G
import lisabot3.responder as B
from lisabot3.lisa import vocab

GROUPER = BufferBy(compose(partial(OP.lt, 140 - 6), compose(sum, Map(len))))

ENTITIES = re.compile("[QR]T @\w+.*|\.(@\w+ )+|http:\/\/(\w+|\.|\/)*|@\w+")

class ResponderLisa(B.Base, B.Storable, vocab.Vocabulary):
    store_attributes = ["impression", "talked", "markov_table", "assoc_table"]
    def __init__(self, name):
        from curtana.lib.parser_aliases import RE, R
        B.Base.__init__(self, ApiMod.from_name(name))
        vocab.Vocabulary.__init__(self)
        
        self.screen_name = name
        self.talked = []
        self.assoc_table = Counter()
        self.markov_table = G.Table()
        self.load(B.PATH)