Пример #1
0
 def __init__(self, train_mode=0):
     self.train_mode = train_mode
     agent = DQNAgent(mode=self.train_mode)
     user = user_simulator()
     self.manager = dialog_manager(agent,
                                   user,
                                   self.train_mode,
                                   maximum_turn=20)
     self.simulation_epoch_size = 800
Пример #2
0
# Python Lib Imports
import string,cgi,time
from os import curdir, sep, getenv
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import urlparse
import dialog_manager as dm

# File Imports
import trainer as tr
import utility as ut
import trainer_reader as rdr


# Create Dialog Manager Object to perform 
# classification
Dialog_Manager = dm.dialog_manager()

class MyHandler(BaseHTTPRequestHandler):
    """HTTP Server Handler Class; Responds to Questions Posed by Get Messages.  """

    def do_GET(self):
        """Use Get Method to perform Natural Language Processing.

        Get Args:
            anno: Annotation for the NLP.
            message: The Message to be responded to.

        Returns: 
            A response as obtained from the dialogue Manager
            for the given Question
Пример #3
0
"""
This file is the main file of the project. Run this to see the results. 
"""

import dialog_manager as DM
import q_classify as QC
from nltk.tag import pos_tag
import utility as ut
import nltk
import trysearch as ts
import AlchemyAPI as AP

Dialog_Manager = DM.dialog_manager()
q_class = QC.q_classification()

var = 1
while var:
	
	print '\n'
	string = raw_input(" Enter the question: ")
	
	if string in ["end","End","exit","Exit"]:
		var = 0
	else:
		temp = [ (a,b) for (a,b) in pos_tag(nltk.tokenize.word_tokenize(ut.clean(string)))]
		temp1 = dict()
		temp2 = ''
		for (a,b) in temp:
			if a == 'i':
				a = 'i'
			elif b == 'RB' or b == 'VB':
Пример #4
0
"""
This file is the main file of the project. Run this to see the results. 
"""

import dialog_manager as DM
import q_classify as QC
from nltk.tag import pos_tag
import utility as ut
import nltk
import trysearch as ts
import AlchemyAPI as AP

Dialog_Manager = DM.dialog_manager()
q_class = QC.q_classification()

var = 1
while var:

    print '\n'
    string = raw_input(" Enter the question: ")

    if string in ["end", "End", "exit", "Exit"]:
        var = 0
    else:
        temp = [
            (a, b)
            for (a,
                 b) in pos_tag(nltk.tokenize.word_tokenize(ut.clean(string)))
        ]
        temp1 = dict()
        temp2 = ''