class_docstr: Configured metrics for token classification
class_docstr_tok: ["Configured","metrics","for","token","classification"]
code: def mentions_metrics(
      record: ServiceTokenClassificationRecord,
      mentions: List[Tuple[str, EntitySpan]],
  ):
      def mention_tokens_length(entity: EntitySpan) -> int:
          """Compute mention tokens length"""
          return len(
              set(
                  [
                      token_idx
                      for i in range(entity.start, entity.end)
                      for token_idx in [
                          record.span_utils.char_to_token_idx.get(i)
                      ]
                      if token_idx is not None
                  ]
              )
          )
  
      return [
          MentionMetrics(
              value=mention,
              label=entity.label,
              score=entity.score,
              capitalness=TokenClassificationMetrics.capitalness(
                  mention
              ),
          )
          for mention, entity in mentions
      ]
  
imports: from typing import Any, ClassVar, Dict, Iterable, List, Optional, Set, Tuple
  from argilla.server.pydantic_v1 import BaseModel, Field
  from argilla.server.services.metrics import ServiceBaseMetric, ServicePythonMetric
  from argilla.server.services.metrics.models import CommonTasksMetrics
  from argilla.server.services.search.model import ServiceRecordsQuery
  from argilla.server.services.tasks.token_classification.model import EntitySpan, ServiceTokenClassificationAnnotation, ServiceTokenClassificationRecord
  from argilla.utils import SpanUtils
label_desc: Use image node_id 3 for calling the TokenClassificationMetrics obj's underlying member method code with example usage: obj.mentions_metrics(record, mentions) and returns: unknown, len