Gabriela Nicole Gonzalez Saez commited on
Commit
1115254
1 Parent(s): 3774152

en-zh short sentences error

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -150,12 +150,13 @@ def split_token_from_sequences(sequences, model) -> dict :
150
 
151
  # new_id = step_w +'-' + str(step_i)
152
  # parent_id = words_by_step[step_i-1][i_bs] + '-' + str(step_i -1)
153
-
154
  if step_i == 0 :
155
  parent_id = 'bos--1'
156
  ## if the dict already exists remove it, if it is not a root...
157
  ## root?? then next is ''
158
- next_word_flag = len(gen_sequences_texts[i_bs][step_i]) > step_i
 
159
  if next_word_flag:
160
  if not (new_id in id_dict_pos):
161
  dict_parent.append({'id': new_id, 'parentId': parent_id , 'text': step_w, 'name': step_w, 'prob' : score })
 
150
 
151
  # new_id = step_w +'-' + str(step_i)
152
  # parent_id = words_by_step[step_i-1][i_bs] + '-' + str(step_i -1)
153
+ next_word_flag = 1
154
  if step_i == 0 :
155
  parent_id = 'bos--1'
156
  ## if the dict already exists remove it, if it is not a root...
157
  ## root?? then next is ''
158
+ else:
159
+ next_word_flag = len(gen_sequences_texts[i_bs][step_i]) > step_i ## Not in step_i = 0;
160
  if next_word_flag:
161
  if not (new_id in id_dict_pos):
162
  dict_parent.append({'id': new_id, 'parentId': parent_id , 'text': step_w, 'name': step_w, 'prob' : score })