From 45ff0000ae75712ff3200ce742469d3e64fadc68 Mon Sep 17 00:00:00 2001 From: sufianj Date: Fri, 19 Aug 2022 20:30:50 +0200 Subject: [PATCH] Update Custom_Named_Entity_Recognition_with_BERT.ipynb Hello, adding label for special token [SEP] to the end of the label list should be either labels.append("O") or labels.insert(len(labels), "O"). --- BERT/Custom_Named_Entity_Recognition_with_BERT.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BERT/Custom_Named_Entity_Recognition_with_BERT.ipynb b/BERT/Custom_Named_Entity_Recognition_with_BERT.ipynb index 956d6b6f..6b81a6b2 100644 --- a/BERT/Custom_Named_Entity_Recognition_with_BERT.ipynb +++ b/BERT/Custom_Named_Entity_Recognition_with_BERT.ipynb @@ -4131,7 +4131,7 @@ " # step 2: add special tokens (and corresponding labels)\n", " tokenized_sentence = [\"[CLS]\"] + tokenized_sentence + [\"[SEP]\"] # add special tokens\n", " labels.insert(0, \"O\") # add outside label for [CLS] token\n", - " labels.insert(-1, \"O\") # add outside label for [SEP] token\n", + " labels.append(\"O\") # add outside label for [SEP] token\n", "\n", " # step 3: truncating/padding\n", " maxlen = self.max_len\n", @@ -5710,4 +5710,4 @@ ] } ] -} \ No newline at end of file +}