From d224c8da3cc180df00966f8f2d6f6ab93cffd6af Mon Sep 17 00:00:00 2001 From: Tahamid <65755398+usiam@users.noreply.github.com> Date: Sat, 12 Aug 2023 17:43:56 -0400 Subject: [PATCH] Update 3.mdx Add "index" key to the code. It was missing in the code even though the print outputs showed the "index" key. --- chapters/en/chapter6/3.mdx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chapters/en/chapter6/3.mdx b/chapters/en/chapter6/3.mdx index 88250f6df..d9baea665 100644 --- a/chapters/en/chapter6/3.mdx +++ b/chapters/en/chapter6/3.mdx @@ -322,7 +322,7 @@ for idx, pred in enumerate(predictions): label = model.config.id2label[pred] if label != "O": results.append( - {"entity": label, "score": probabilities[idx][pred], "word": tokens[idx]} + {"entity": label, "score": probabilities[idx][pred], "index": idx, "word": tokens[idx]} ) print(results) @@ -380,6 +380,7 @@ for idx, pred in enumerate(predictions): { "entity": label, "score": probabilities[idx][pred], + "index": idx, "word": tokens[idx], "start": start, "end": end,