def __init__(self, sentence): self.prop = { "depparse.extradependencies": "NONE", "depparse.keepPunct": "false" } self.dep_parser = CoreNLPDependencyParser(url='http://localhost:9000') self.text = ner.NER().ner_pass(sentence) self.parsed, = self.dep_parser.raw_parse(self.text, properties=self.prop)
def score(task): task_type = cu.tasks.get(str(task)).get('type') if task_type == 'classification': _dt = dt.Data(task=task, inference=True) return Inferencer.load(_dt.get_path('model_dir')) elif task_type == 'multi_classification': _dt = dt.Data(task=task, inference=True) return Inferencer.load(_dt.get_path('model_dir')) elif task_type == 'ner': return ner.NER(task=task, inference=True) elif task_type == 'qa': return rank.Rank(task=task, inference=True) else: logger.warning('TASK TYPE NOT SUPPORTED') return None
attr = [] table = [] print("**** Attributes are*****") print(att) for i in att: x, y, z = sm.getSimilarAttribute(i) print(x, y, z) if y not in attr and y is not "": attr.append(y) if x not in table and x != "not available": table.append(x) query = "Select " + ' , '.join(map(str, attr)) + " from " + ' , '.join( map(str, table)) print("Similarity : ", z) try: where = sm.whereSim(list(Sql.conditions.values()), table) except AttributeError: pass try: if where: query = query + where query = ner.NER().ner_pass2(query) except: NameError
def run(query): if query != "": Sql = SqlGen(query) data = Sql.getData("pandas1") #print(Sql.getData("pandas2")) #print(Sql.getData("pandas3")) #print("******************************Action****************************") #print(Sql.getAction(data)) #print("******************************End of Action ****************************") #print("******************************Attributes are ****************************") Sql.getAttributes(data) #print(Sql.attributes) #print("******************************End of Attributes ****************************") #print("******************************ValueNodes are ****************************") Sql.getValueNodes(data) #print(Sql.conditions) #print("******************************End of ValueNodes ****************************") att = Sql.findAssociation(Sql.attributes) attr = [] table = [] thekey = [] #print("**** Attributes are*****") #print(att) for i in att: x, y, z, tkey = sm.getSimilarAttribute(i) if y not in attr and y is not "": attr.append(y) thekey.append(tkey) if x not in table and x != "not available": table.append(x) query = "Select " + ' , '.join(map(str, attr)) + " from " + ' , '.join( map(str, table)) #print(query) positions = [] try: #print("Similarity : ", z) where, positions = sm.whereSim(list(Sql.conditions.values()), table) except NameError: pass except ValueError: pass except AttributeError: pass try: if where: query = query + where query = ner.NER().ner_pass2(query) positions = ner.NER().ner_pass3(positions) except: NameError #print(query) return query, thekey, positions