MCPcopy Create free account
hub / github.com/brightmart/text_classification / load_data_predict

Function load_data_predict

a08_EntityNetwork/data_util_zhihu.py:416–431  ·  view source on GitHub ↗
(vocabulary_word2index,vocabulary_word2index_label,questionid_question_lists,uni_to_tri_gram=False)

Source from the content-addressed store, hash-verified

414 return question_lists_result
415
416def load_data_predict(vocabulary_word2index,vocabulary_word2index_label,questionid_question_lists,uni_to_tri_gram=False): # n_words=100000,
417 final_list=[]
418 for i, tuplee in enumerate(questionid_question_lists):
419 queston_id,question_string_list=tuplee
420 if uni_to_tri_gram:
421 x_=process_one_sentence_to_get_ui_bi_tri_gram(question_string_list)
422 x=x_.split(" ")
423 else:
424 x=question_string_list.split(" ")
425 x = [vocabulary_word2index.get(e, 0) for e in x] #if can't find the word, set the index as '0'.(equal to PAD_ID = 0)
426 if i<=2:
427 print("question_id:",queston_id);print("question_string_list:",question_string_list);print("x_indexed:",x)
428 final_list.append((queston_id,x))
429 number_examples = len(final_list)
430 print("number_examples:",number_examples) #
431 return final_list
432
433
434def proces_label_to_algin(ys_list,require_size=5):

Callers 1

mainFunction · 0.90

Tested by

no test coverage detected