class_docstr: Pipeline component to label spans of text.
  
  DOCS: https://spacy.io/api/spancategorizer
class_docstr_tok: ["Pipeline","component","to","label","spans","of","text",".","DOCS",":","https",":","\/\/spacy.io\/api\/spancategorizer"]
docstr: Initialize the pipe for training, using a representative set
  of data examples.
  
  get_examples (Callable[[], Iterable[Example]]): Function that
      returns a representative sample of gold-standard Example objects.
  nlp (Optional[Language]): The current nlp object the component is part of.
  labels (Optional[List[str]]): The labels to add to the component, typically generated by the
      `init labels` command. If no labels are provided, the get_examples
      callback is used to extract the labels from the data.
  
  DOCS: https://spacy.io/api/spancategorizer#initialize
docstr_tok: ["Initialize","the","pipe","for","training",",","using","a","representative","set","of","data","examples",".","get_examples","(","Callable","[","[","]",",","Iterable","[","Example","]","]",")",":","Function","that","returns","a","representative","sample","of","gold-standard","Example","objects",".","nlp","(","Optional","[","Language","]",")",":","The","current","nlp","object","the","component","is","part","of",".","labels","(","Optional","[","List","[","str","]","]",")",":","The","labels","to","add","to","the","component",",","typically","generated","by","the","`","init","labels","`","command",".","If","no","labels","are","provided",",","the","get_examples","callback","is","used","to","extract","the","labels","from","the","data",".","DOCS",":","https",":","\/\/spacy.io\/api\/spancategorizer","#","initialize"]
code: def initialize(
      self,
      get_examples: Callable[[], Iterable[Example]],
      *,
      nlp: Optional[Language] = None,
      labels: Optional[List[str]] = None,
  ) -> None:
      """Initialize the pipe for training, using a representative set
      of data examples.
  
      get_examples (Callable[[], Iterable[Example]]): Function that
          returns a representative sample of gold-standard Example objects.
      nlp (Optional[Language]): The current nlp object the component is part of.
      labels (Optional[List[str]]): The labels to add to the component, typically generated by the
          `init labels` command. If no labels are provided, the get_examples
          callback is used to extract the labels from the data.
  
      DOCS: https://spacy.io/api/spancategorizer#initialize
      """
      subbatch: List[Example] = []
      if labels is not None:
          for label in labels:
              self.add_label(label)
      for eg in get_examples():
          if labels is None:
              for span in eg.reference.spans.get(self.key, []):
                  self.add_label(span.label_)
          if len(subbatch) < 10:
              subbatch.append(eg)
      self._require_labels()
      if subbatch:
          docs = [eg.x for eg in subbatch]
          spans = build_ngram_suggester(sizes=[1])(docs)
          Y = self.model.ops.alloc2f(
              spans.dataXd.shape[0], self._n_labels
          )
          self.model.initialize(X=(docs, spans), Y=Y)
      else:
          self.model.initialize()
  
imports: from dataclasses import dataclass
  from functools import partial
  from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union, cast
  import numpy
  from thinc.api import Config, Model, Ops, Optimizer, get_current_ops, set_dropout_rate
  from thinc.types import Floats2d, Ints1d, Ints2d, Ragged
  from ..compat import Protocol, runtime_checkable
  from ..errors import Errors
  from ..language import Language
  from ..scorer import Scorer
  from ..tokens import Doc, Span, SpanGroup
  from ..training import Example, validate_examples
  from ..util import registry
  from ..vocab import Vocab
  from .trainable_pipe import TrainablePipe
label_desc: Use image node_id 15 for calling the SpanCategorizer obj's underlying member method code with example usage: obj.initialize(get_examples) without return types