MCPcopy Create free account
hub / github.com/huggingface/transformers / get_labels

Function get_labels

examples/token-classification/utils_ner.py:390–398  ·  view source on GitHub ↗
(path: str)

Source from the content-addressed store, hash-verified

388
389
390def get_labels(path: str) -> List[str]:
391 if path:
392 with open(path, "r") as f:
393 labels = f.read().splitlines()
394 if "O" not in labels:
395 labels = ["O"] + labels
396 return labels
397 else:
398 return ["O", "B-MISC", "I-MISC", "B-PER", "I-PER", "B-ORG", "I-ORG", "B-LOC", "I-LOC"]

Callers 3

mainFunction · 0.90
__init__Method · 0.90
mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected