class_docstr: A spaCy Language wrapper for NLP NER monitoring in argilla
class_docstr_tok: ["A","spaCy","Language","wrapper","for","NLP","NER","monitoring","in","argilla"]
docstr: Converts a spaCy `Doc` into a token classification record
  
  Parameters
  ----------
  doc:
      The spacy doc
  agent:
      Agent to use for the prediction_agent field. Could be the model path or model lang + model version
  metadata:
      Passed on to the `argilla.TokenClassificationRecord`.
docstr_tok: ["Converts","a","spaCy","`","Doc","`","into","a","token","classification","record","Parameters","--","--","--","--","--","doc",":","The","spacy","doc","agent",":","Agent","to","use","for","the","prediction_agent","field",".","Could","be","the","model","path","or","model","lang","+","model","version","metadata",":","Passed","on","to","the","`","argilla.TokenClassificationRecord","`","."]
code: def doc2token_classification(
      doc: Doc,
      agent: str,
      metadata: Optional[Dict[str, Any]],
  ) -> TokenClassificationRecord:
      """
      Converts a spaCy `Doc` into a token classification record
  
      Parameters
      ----------
      doc:
          The spacy doc
      agent:
          Agent to use for the prediction_agent field. Could be the model path or model lang + model version
      metadata:
          Passed on to the `argilla.TokenClassificationRecord`.
  
      """
      entities = [
          (ent.label_, ent.start_char, ent.end_char) for ent in doc.ents
      ]
      return TokenClassificationRecord(
          text=doc.text,
          tokens=[t.text for t in doc],
          metadata=metadata or {},
          prediction_agent=agent,
          prediction=entities,
          event_timestamp=datetime.utcnow(),
      )
  
file_path: argilla/src/argilla/monitoring/_spacy.py
imports: from datetime import datetime
  from typing import Any, Dict, Optional, Tuple
  from argilla import TokenClassificationRecord
  from argilla.client.api import Api
  from argilla.monitoring.base import BaseMonitor
  from argilla.monitoring.types import MissingType
label_desc: Use image node_id 1 for calling the SpacyNERMonitor obj's underlying member method code with example usage: obj.doc2token_classification(doc, agent, metadata) and returns: TokenClassificationRecord