Exemplo n.º 1
0
def main():
	p = subprocess.Popen("whoami", stdout=subprocess.PIPE, shell=True)
	(output, err) = p.communicate()
	print "Hello " + output.capitalize().strip() + ". How can I help you"
	root=[]
	while True:
		fp=open('Patterns','r').read()
		data=json.loads(fp)
		(entity_list,domain_list,synonym_list)=jp.get_list_attributes(data)
		model=tagger.train_tagger(entity_list)
		line=raw_input('Question:\n')
		line=line.strip(' \n')
		line.lower()
		line.replace("'s",' ')
		tagged_line=tagger.tagit(line,model)
Exemplo n.º 2
0
def main():
	print "Fe Li & Co invites you to Felicity 2013 :)\nFeel free to ask any Question to us\n"
	root=[]
	while True:
		fp=open('Data_json','r').read()
		data=json.loads(fp)
		(entity_list,domain_list,synonym_list)=jp.get_list_attributes(data)
		model=tagger.train_tagger(entity_list)
		line=raw_input('Question:\n')
		line=line.strip(' \n')
		line.lower()
		line.replace("'s",' ')
		tagged_line=tagger.tagit(line,model)
		(ans,root)=qp.chat_bot(tagged_line,entity_list,domain_list,synonym_list,data,root,line)
		print ans
Exemplo n.º 3
0
def main():
    print "Fe Li & Co invites you to Felicity 2013 :)\nFeel free to ask any Question to us\n"
    root = []
    while True:
        fp = open('Data_json', 'r').read()
        data = json.loads(fp)
        (entity_list, domain_list, synonym_list) = jp.get_list_attributes(data)
        model = tagger.train_tagger(entity_list)
        line = raw_input('Question:\n')
        line = line.strip(' \n')
        line.lower()
        line.replace("'s", ' ')
        tagged_line = tagger.tagit(line, model)
        (ans, root) = qp.chat_bot(tagged_line, entity_list, domain_list,
                                  synonym_list, data, root, line)
        print ans
Exemplo n.º 4
0
#!/usr/bin/python
import json
import json_parser as jp
from collections import defaultdict
fp=open('Data_json','r').read()
data=json.loads(fp)
logical=data['logical']
my_dict={}
my_dict=defaultdict(lambda:[],my_dict)
(entity_list,domain_list,synonym_list)=jp.get_list_attributes(data)
for each_key in entity_list:
	for key in domain_list:
		if key in logical[each_key].keys():
			my_dict[key].extend(logical[each_key][key]['tagset'])
for each_key in entity_list:
	for key in domain_list:
		if key in logical[each_key].keys():
			logical[each_key][key]['tagset']=','.join(list(set(my_dict[key])))
fp1=open('Updated','w')			
fp1.write(json.dumps(data, sort_keys=True, indent=9))
	
Exemplo n.º 5
0
#!/usr/bin/python
import json
import json_parser as jp
from collections import defaultdict
fp = open('Data_json', 'r').read()
data = json.loads(fp)
logical = data['logical']
my_dict = {}
my_dict = defaultdict(lambda: [], my_dict)
(entity_list, domain_list, synonym_list) = jp.get_list_attributes(data)
for each_key in entity_list:
    for key in domain_list:
        if key in logical[each_key].keys():
            my_dict[key].extend(logical[each_key][key]['tagset'])
for each_key in entity_list:
    for key in domain_list:
        if key in logical[each_key].keys():
            logical[each_key][key]['tagset'] = ','.join(list(set(
                my_dict[key])))
fp1 = open('Updated', 'w')
fp1.write(json.dumps(data, sort_keys=True, indent=9))