feat: tagIdConverter size property

This commit is contained in:
monoid 2022-02-22 23:35:59 +09:00
parent 28ddd289b7
commit 30cb6b8fe0

View File

@ -103,6 +103,12 @@ class TagIdConverter:
@property @property
def pad_id(self): def pad_id(self):
return self.vocab["[PAD]"] 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]): def convert_ids_to_tokens(self,ids: List[int]):
return [self.ids_to_token[id] for id in ids] return [self.ids_to_token[id] for id in ids]