fuhsiao commited on
Commit
f10533a
·
1 Parent(s): ffe67a5
Files changed (1) hide show
  1. utils/methods.py +0 -6
utils/methods.py CHANGED
@@ -50,11 +50,7 @@ def convert_sentence_df(sentJson, pred, true_proba, set_trigram_blocking):
50
  def extractive_method(sentJson, sentFeat, model, threshold=0.5, TGB=False):
51
  #預測
52
  def predict(x):
53
- print(x)
54
  true_proba = model.predict_proba(x)[:, 1]
55
- print(threshold)
56
- print(type(threshold))
57
- print(true_proba)
58
  # 如果沒有任何句子的預測機率大於閾值,則選取最大機率的句子為摘要句
59
  if not np.any(true_proba > threshold):
60
  true_proba[true_proba == np.max(true_proba)] = 1
@@ -72,8 +68,6 @@ def extractive_method(sentJson, sentFeat, model, threshold=0.5, TGB=False):
72
  pred.append(pred_sec)
73
  true_proba.append(true_proba_sec)
74
 
75
-
76
- pred, true_proba = predict(sentFeat)
77
  body = convert_sentence_df(sentJson, pred, true_proba, TGB)
78
  res = body[body['predict'] == True]
79
  ext = {i: ' '.join(res.groupby('section').get_group(i)['text']) for i in 'IMRD'}
 
50
  def extractive_method(sentJson, sentFeat, model, threshold=0.5, TGB=False):
51
  #預測
52
  def predict(x):
 
53
  true_proba = model.predict_proba(x)[:, 1]
 
 
 
54
  # 如果沒有任何句子的預測機率大於閾值,則選取最大機率的句子為摘要句
55
  if not np.any(true_proba > threshold):
56
  true_proba[true_proba == np.max(true_proba)] = 1
 
68
  pred.append(pred_sec)
69
  true_proba.append(true_proba_sec)
70
 
 
 
71
  body = convert_sentence_df(sentJson, pred, true_proba, TGB)
72
  res = body[body['predict'] == True]
73
  ext = {i: ' '.join(res.groupby('section').get_group(i)['text']) for i in 'IMRD'}