From 30cb6b8fe06872cf038eb0e31a59940fe868faf7 Mon Sep 17 00:00:00 2001 From: monoid Date: Tue, 22 Feb 2022 23:35:59 +0900 Subject: [PATCH] feat: tagIdConverter size property --- read_data.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/read_data.py b/read_data.py index 8b7851e..907771e 100644 --- a/read_data.py +++ b/read_data.py @@ -103,7 +103,13 @@ class TagIdConverter: @property def pad_id(self): return self.vocab["[PAD]"] + @property + def size(self): + return len(self.vocab) + def __len__(self): + return self.size + def convert_ids_to_tokens(self,ids: List[int]): return [self.ids_to_token[id] for id in ids] def convert_tokens_to_ids(self, tokens: List[str]):