Skip to content

Commit

Permalink
hotfix issue #6
Browse files Browse the repository at this point in the history
  • Loading branch information
huseinzol05 committed Oct 6, 2018
1 parent 62a4600 commit 597c9e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions malaya/pos_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ def predict(self,string):
return self.__predict(string,self.sess,self.nodes)

def get_entity_char(string,sess,model):
batch_x = str_idx([process_word_pos_entities(w) for w in string.split()],model['char2idx'],0)
batch_x = char_str_idx([process_word_pos_entities(w) for w in string.split()],model['char2idx'],0)
logits, logits_pos = sess.run([tf.argmax(model['logits'],1),tf.argmax(model['logits_pos'],1)],feed_dict={model['X']:batch_x})
results = []
for no, i in enumerate(string.split()):
results.append((i,model['idx2tag'][str(logits[no])],model['idx2pos'][str(logits_pos[no])]))
return results

def get_entity_concat(string,sess,model):
array_X = str_idx([[process_word_pos_entities(w) for w in string.split()]],model['word2idx'],2)
array_X = char_str_idx([[process_word_pos_entities(w) for w in string.split()]],model['word2idx'],2)
batch_x_char = generate_char_seq(array_X,model['idx2word'],model['char2idx'])
Y_pred,Y_pos = sess.run([model['crf_decode'],model['crf_decode_pos']],feed_dict={model['word_ids']:array_X,
model['char_ids']:batch_x_char})
Expand Down

0 comments on commit 597c9e2

Please sign in to comment.