예제 #1
0
파일: eve.py 프로젝트: Invision70/E.V.E.
def start_text_prompt():
	"""Initialize the program and open text prompt for activation commands."""
	brn = Brain()
	print "Starting standard input mode."
	while 1:
		line = raw_input("> ")
		brn.process_input(line, None)
예제 #2
0
파일: eve.py 프로젝트: Invision70/E.V.E.
def start_listening():
	"""Initialize the program and start listening for activation commands."""
	brn = Brain()
	proc = subprocess.Popen(['padsp', 'julius', '-quiet', 
			'-input', 'mic', 
			'-C', JULIUS_FILE], 
			stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

	while 1: 
		line = proc.stdout.readline()
		if brn.process_input(line, proc) == True:
			proc = subprocess.Popen(['padsp', 'julius', '-quiet', 
				'-input', 'mic', 
				'-C', JULIUS_FILE], 
				stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
		sys.stdout.flush()
예제 #3
0
파일: eve.py 프로젝트: ANtlord/E.V.E.
def start_julius_listening(inputMode):
	cmd = Brain()

	proc = subprocess.Popen(['padsp', 'julius', '-quiet', 
			'-input', 'mic', 
			'-C', './julius/julian.jconf'], 
			stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

	if inputMode == "voice":
		while 1: 
			juliusInp = proc.stdout.readline()
			cmd.get_input(juliusInp)
			sys.stdout.flush()
	else:
		print "Starting standard input mode."
		while 1: 
			inp = "sentence1: <s> " + raw_input("> ") + " </s>"
			cmd.get_input(inp)
예제 #4
0
def start_listening():
    """Initialize the program and start listening for activation commands."""
    brn = Brain()
    proc = subprocess.Popen(
        ["padsp", "julius", "-quiet", "-input", "mic", "-C", JULIUS_FILE],
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT,
    )

    while 1:
        line = proc.stdout.readline()
        if brn.process_input(line, proc) == True:
            proc = subprocess.Popen(
                ["padsp", "julius", "-quiet", "-input", "mic", "-C", JULIUS_FILE],
                stdout=subprocess.PIPE,
                stderr=subprocess.STDOUT,
            )
        sys.stdout.flush()
예제 #5
0
from interface.surface import Surface
from brain.brain import Brain
from brain.characterReader import CharacterReader

brains = [
    Brain("0ODGCQ"),
    Brain("1IJ3B8"),
    Brain("2Z5SEF"),
    Brain("AHTKXW"),
    Brain("MNVUY7"),
    Brain("469LPR")
]
centralBrain = Brain("Central")
centralBrain.load("data/brains/Central.p")

for brain in brains:
    brain.load("data/brains/%s.p" % brain.charset)

characterReader = CharacterReader(brains, centralBrain)

surface = Surface(characterReader)
surface.display()
예제 #6
0
def main():
    """ Main entry for the auto-blogger program """
    args = load_configuration()
    league_id = args['league_id']
    season_id = args['season_id']
    week_id = args['week_id']

    # Scrape all team data from the ESPN website
    espn = ESPNScraper(league_id, season_id)
    
    if 'is_playoffs' in args:
        matchup_id = args['matchup_id']
        all_teams = espn.get_teams_playoffs(matchup_id, week_id)
    else:
        all_teams = espn.get_teams(week_id)

    # Create the blogging helper to write HTML
    blogger = Blogger()
    blogger.blank(count=3)

    # Use a brain to write interesting blogs
    brain = Brain(week_id, all_teams, blogger)

    brain.blog_current_standings()
    blogger.blank(count=3)

    brain.blogger.horizontal_line()
    brain.blogger.heading("League Wide Winners and Losers", underline=True, center=True)
    brain.blog_star_players(count=5)
    brain.blog_bust_players(count=5)
    brain.blog_bench_star_players(count=5)

    brain.blogger.horizontal_line()
    brain.blog_match_summaries()

    next_week_id = str(int(week_id) + 1)
    next_week_teams = espn.get_teams_scoreboard(next_week_id)
    brain.blog_coming_up_next(next_week_id, next_week_teams)

    # Write the formatted blog entry for the week
    output_file = os.path.expandvars('%UserProfile%\\Documents\\{0}_week_{1}.html'.format(season_id, week_id))
    blogger.write_file(output_file)
예제 #7
0
from brain.brain import Brain

charsets = ["0ODGCQ", "1IJ3B8", "2Z5SEF", "AHTKXW", "MNVUY7", "469LPR"]

brains = {
    "0ODGCQ": Brain(6),
    "1IJ3B8": Brain(6),
    "2Z5SEF": Brain(6),
    "AHTKXW": Brain(6),
    "MNVUY7": Brain(6),
    "469LPR": Brain(6)
}

central = Brain(6)

badNetwork = 0
badNetworkDetected = 0
badNetworkDetectedFP = 0
goodNetwork = 0
correct = 0
bad = 0

central.load("data/brains/Central.p")
for name in brains:
    brains[name].load("data/brains/%s.p" % name)

characterLines = open('data/characters_unknown.txt', 'r').readlines()
#characterLines = open('data/characters.txt', 'r').readlines()

o = -1
예제 #8
0
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from brain.brain import Brain
from bot.session import Session
sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
from databaseImport.databaseUpdate import DbUpdate as dbUpdate
from dumpMessage.dump import Dump

#class PickMessage(object):


def pickAndProcess(dbUpdateObject, sessionObject, brainObject, dumpObject):
    l = dbUpdateObject.selectResponseMessageLastEntry()
    if (l != None):
        l = dbUpdateObject.selectReceiveMessageById(str(l[0]))
    else:
        l = dbUpdateObject.selectReceiveMessageAll()
    for item in l:
        brainObject.brain1(dbUpdateObject, sessionObject, item, dumpObject)


if __name__ == "__main__":
    dbUpdateObject = dbUpdate()
    sessionObject = Session()
    brainObject = Brain()
    dumpObject = Dump()
    #pickObject=PickMessage();
    sessionObject.learn()
    while (1):
        pickAndProcess(dbUpdateObject, sessionObject, brainObject, dumpObject)
        time.sleep(1)
예제 #9
0
from brain.brain import Brain
from brain.characterReader import CharacterReader
import time

brains = {
    "0ODGCQ": Brain(6),
    "1IJ3B8": Brain(6),
    "2Z5SEF": Brain(6),
    "AHTKXW": Brain(6),
    "MNVUY7": Brain(6),
    "469LPR": Brain(6)
}

characterReader = CharacterReader(brains)
characterLines = open('data/characters_unknown.txt', 'r').readlines()
#characterLines = open('data/characters.txt', 'r').readlines()

charCount = {}
characters1 = {}
characters2 = {}
characters3 = {}

#while True:
if True:
    for name in brains:
        brains[name].load("data/brains/%s.p" % name)

    characterReader = CharacterReader(brains)

    total = 1.0
    correct = 0.0
예제 #10
0
# -*- coding: utf-8 -*-
from brain.brain import Brain
from logbook import Logger

from waTer.utils.read_conf import get_conf
from waTer.utils.setup_logger import setup_logger

log = Logger('running')


def start_app():
    conf = get_conf('configuration/app_conf.toml')
    log_conf = conf['log']
    setup_logger(log_conf)
    return conf


if __name__ == '__main__':
    conf = start_app()
    brain = Brain(conf)
    brain.go()
예제 #11
0
# author: Karel Fiala
# email: [email protected]

# version 0.2.0

import threading
from config import *
from network import Network
from brain.brain import Brain
import sys

# ======================

# create brain
global brain
brain = Brain()

# start listening
udp = Network("0.0.0.0", SERVER_PORT)

# ======================


def reqrecv():
    #global udp
    try:
        while True:
            d = udp.recv()
            ip = udp.recv_from()
            (threading.Thread(target=brain.process, args=(d, ip))).start()
예제 #12
0
from interface.surface import Surface
from brain.brain import Brain
from brain.characterReader import CharacterReader
import time

brains = {
    "0ODGCQ": Brain(6),
    #"1IJ3B8" : Brain(6),
    #"2Z5SEF" : Brain(6),
    #"AHTKXW" : Brain(6),
    "MNVUY7": Brain(6),
    #"469LPR" : Brain(6)
}

characterReader = CharacterReader(brains)
#characterLines = open('data/characters.txt', 'r').readlines()
characterLines = open('data/characters_unknown.txt', 'r').readlines()

for name in brains:
    brains[name].load("data/brains-similaire-plus-0/%s.p" % name)

file = open('bench-v2.txt', 'w')
for line in characterLines:
    line = line.strip().split("\t")

    inputPixelString = line[1]

    expected = line[0]

    for charset in brains:
        if expected in charset:
예제 #13
0
# -*- coding: utf-8 -*-
import argparse
import os

from brain.brain import BASE_DIR, Brain
from brain.db import Database
from brain.mailer import Mailer
from brain.brain import parse_clients

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument("--database", help="Database Name", type=str, default='demo.db')
    parser.add_argument("--smtp-ip", help="SMTP IP Address", type=str, default='192.168.100.200')
    parser.add_argument("--smtp-port", help="SMTP Port", type=int, default=1025)
    parser.add_argument('--client-config', help='Client Configuration File', type=str, default='brain/config.xml')
    parser.add_argument('--cipher-key', help='Encryption Key', type=str)
    args = parser.parse_args()

    clients = parse_clients(args.client_config)

    db = Database(args.database)
    db.connect()
    db.create_table()

    mailer = Mailer(hostname=args.smtp_ip, port=args.smtp_port)

    brain = Brain(clients=clients, db=db, mailer=mailer, cipher_key=args.cipher_key)
    brain.run()