分詞器文件

視覺化工具

Hugging Face's logo
加入 Hugging Face 社群

並獲得增強的文件體驗

開始使用

視覺化工具

Python
Rust
Node

Annotation

class tokenizers.tools.Annotation

< >

( start: int end: int label: str )

EncodingVisualizer

class tokenizers.tools.EncodingVisualizer

< >

( 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__

< >

( 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.