Commit 9d0d1cd3 authored by Morgan Funtowicz's avatar Morgan Funtowicz
Browse files

Filter out entity for NER task.

parent e4baa68d
...@@ -450,6 +450,7 @@ class NerPipeline(Pipeline): ...@@ -450,6 +450,7 @@ class NerPipeline(Pipeline):
score = np.exp(entities[token_start]) / np.exp(entities[token_start]).sum(-1, keepdims=True) score = np.exp(entities[token_start]) / np.exp(entities[token_start]).sum(-1, keepdims=True)
label_idx = score.argmax() label_idx = score.argmax()
if label_idx > 0:
answer += [{ answer += [{
'word': words[idx], 'word': words[idx],
'score': score[label_idx].item(), 'score': score[label_idx].item(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment