MCPcopy Create free account
hub / github.com/hankcs/HanLP / __init__

Method __init__

hanlp/common/transform.py:469–473  ·  view source on GitHub ↗
(self, src: str, dst: str = None, delta=0)

Source from the content-addressed store, hash-verified

467class FieldLength(NamedTransform):
468
469 def __init__(self, src: str, dst: str = None, delta=0) -> None:
470 self.delta = delta
471 if not dst:
472 dst = f'{src}_length'
473 super().__init__(src, dst)
474
475 def __call__(self, sample: dict) -> dict:
476 sample[self.dst] = len(sample[self.src]) + self.delta

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected