Commit 23f8b5c5 authored by Matic Perovšek's avatar Matic Perovšek

isprogramirano popravek foreign keys from column names

parent 7cda25b4
......@@ -95,7 +95,7 @@ def ilp_wordification(input_dict):
for _ in range(1):
wordification = Wordification(target_table,other_tables,context,word_att_length)
wordification.run(1)
wordification.calculate_tf_idfs(True)
wordification.calculate_tf_idfs(False)
#wordification.prune(50)
#wordification.to_arff()
#from wordification import Wordification_features_test
......
......@@ -172,10 +172,10 @@ class Wordification(object):
indices = chunks (range(len(self.target_table)),num_of_processes)#)
#for ex_idxs in indices:
# self.resulting_documents.extend(wordify_examples((self.name_to_table,self.connecting_tables,self.context,self.index_by_value,self.target_table.name,self.word_att_length,ex_idxs)))
for ex_idxs in indices:
self.resulting_documents.extend(wordify_examples((self.name_to_table,self.connecting_tables,self.context,self.index_by_value,self.target_table.name,self.word_att_length,ex_idxs)))
#print p.map(wordify_examples, [(self.connecting_tables,self.context,self.cached_sentences,self.index_by_value,self.target_table,self.word_att_length,self.target_table,ex_idxs) for ex_idxs in indices])
self.resulting_documents=[item for sublist in p.map(wordify_examples, [(self.name_to_table,self.connecting_tables,self.context,self.index_by_value,self.target_table.name,self.word_att_length,ex_idxs) for ex_idxs in indices]) for item in sublist]
#self.resulting_documents=[item for sublist in p.map(wordify_examples, [(self.name_to_table,self.connecting_tables,self.context,self.index_by_value,self.target_table.name,self.word_att_length,ex_idxs) for ex_idxs in indices]) for item in sublist]
p.close()
p.join()
......
......@@ -63,7 +63,7 @@ class DBContext:
for table in self.tables:
for col in self.cols[table]:
if col.endswith('_id'):
ref_table = (col[:-4] + 'ies') if col[-4] == 'y' else (col[:-3] + 's')
ref_table = (col[:-4] + 'ies') if col[-4] == 'y' and col[-5] != 'e' else (col[:-3] + 's')
if ref_table in self.tables:
self.connected[(table, ref_table)].append((col, 'id'))
self.connected[(ref_table, table)].append(('id', col))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment