Tokenizers
加入 Hugging Face 社区
并获得增强的文档体验
可视化工具
Annotation
class tokenizers.tools.Annotation
< source > ( start: int end: int label: str )
EncodingVisualizer
class tokenizers.tools.EncodingVisualizer
< source > ( tokenizer: Tokenizer default_to_notebook: bool = True annotation_converter: Optional = None )
参数
- tokenizer (Tokenizer) — 一个分词器实例
- default_to_notebook (
bool
) — 是否默认在 notebook 中渲染 HTML 输出 - annotation_converter (
Callable
, optional) — 一个可选的(lambda)函数,它接受任何格式的标注并返回一个 Annotation 对象
构建一个 EncodingVisualizer
__call__
< source > ( text: str annotations: List = [] default_to_notebook: Optional = None )
参数
- text (
str
) — 要进行分词的文本 - annotations (
List[Annotation]
, optional) — 一个可选的文本标注列表。如果使用转换器函数实例化了可视化工具,则可以是标注类或任何其他类型 - default_to_notebook (
bool
, optional, 默认为 False) — 如果为 True,将在 notebook 中渲染 HTML。否则返回一个 HTML 字符串。
构建给定文本的可视化
< > 在 GitHub 上更新
© . This site is unofficial and not affiliated with Hugging Face, Inc.