def _nlp_parser(self, file_path, index):
"""
parse nlp data
:return:
"""
try :
store = pd.HDFStore(file_path)
chunk = store.select('table1',
start=index.start,
stop=index.stop)
count = index.stop - index.start
if (self.encode_col in chunk):
encode = self.encode_pad(self._preprocess(chunk[self.encode_col].values)[0:count],
max_len=self.encode_len)
return self._word_embed_data(self.embed_type, encode)
else:
warnings.warn("not exists column names requested !!")
return [['#'] * self.encode_len]
except Exception as e :
raise Exception (e)
finally:
store.close()
评论列表
文章目录