MCPcopy
hub / github.com/explosion/spaCy / set_error_handler

Method set_error_handler

spacy/language.py:1394–1410  ·  view source on GitHub ↗

Set an error handler object for all the components in the pipeline that implement a set_error_handler function. error_handler (Callable[[str, Callable[[Doc], Doc], List[Doc], Exception], NoReturn]): Function that deals with a failing batch of documents. This callable

(
        self,
        error_handler: Callable[[str, PipeCallable, List[Doc], Exception], NoReturn],
    )

Source from the content-addressed store, hash-verified

1392 return self._optimizer
1393
1394 def set_error_handler(
1395 self,
1396 error_handler: Callable[[str, PipeCallable, List[Doc], Exception], NoReturn],
1397 ):
1398 """Set an error handler object for all the components in the pipeline
1399 that implement a set_error_handler function.
1400
1401 error_handler (Callable[[str, Callable[[Doc], Doc], List[Doc], Exception], NoReturn]):
1402 Function that deals with a failing batch of documents. This callable
1403 function should take in the component's name, the component itself,
1404 the offending batch of documents, and the exception that was thrown.
1405 DOCS: https://spacy.io/api/language#set_error_handler
1406 """
1407 self.default_error_handler = error_handler
1408 for name, pipe in self.pipeline:
1409 if hasattr(pipe, "set_error_handler"):
1410 pipe.set_error_handler(error_handler)
1411
1412 def evaluate(
1413 self,

Calls

no outgoing calls