BlinkDL commited on
Commit
bbb068e
1 Parent(s): 85b3476

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -74,12 +74,19 @@ def evaluate(
74
  break
75
  all_tokens += [token]
76
  for xxx in occurrence:
77
- occurrence[xxx] *= 0.996
78
- if pipeline.decode([token]) not in ' \r\n\t,.;?!"\':0123456789+-*/=#@$%^&_`~|<>\\()[]{},。;“”:?!()【】':
79
- if token not in occurrence:
80
- occurrence[token] = 1
81
- else:
82
- occurrence[token] += 1
 
 
 
 
 
 
 
83
  tmp = pipeline.decode(all_tokens[out_last:])
84
  if '\ufffd' not in tmp:
85
  out_str += tmp
 
74
  break
75
  all_tokens += [token]
76
  for xxx in occurrence:
77
+ occurrence[xxx] *= 0.996
78
+
79
+ ttt = pipeline.decode([token])
80
+ www = 1
81
+ if ttt in ' \t0123456789':
82
+ www = 0
83
+ elif ttt in '\r\n,.;?!"\':+-*/=#@$%^&_`~|<>\\()[]{},。;“”:?!()【】':
84
+ www = 0.5
85
+ if token not in occurrence:
86
+ occurrence[token] = www
87
+ else:
88
+ occurrence[token] += www
89
+
90
  tmp = pipeline.decode(all_tokens[out_last:])
91
  if '\ufffd' not in tmp:
92
  out_str += tmp