MCPcopy Create free account
hub / github.com/SooLab/CGFormer / special_tokens_map

Method special_tokens_map

bert/tokenization_utils_base.py:873–884  ·  view source on GitHub ↗

A dictionary mapping special token class attribute (cls_token, unk_token...) to their values (' ', ' '...) Convert tokens of AddedToken type in string. All returned tokens are strings

(self)

Source from the content-addressed store, hash-verified

871
872 @property
873 def special_tokens_map(self):
874 """ A dictionary mapping special token class attribute (cls_token, unk_token...) to their
875 values ('<unk>', '<cls>'...)
876 Convert tokens of AddedToken type in string.
877 All returned tokens are strings
878 """
879 set_attr = {}
880 for attr in self.SPECIAL_TOKENS_ATTRIBUTES:
881 attr_value = getattr(self, "_" + attr)
882 if attr_value:
883 set_attr[attr] = str(attr_value)
884 return set_attr
885
886 @property
887 def special_tokens_map_extended(self):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected