class_docstr: Merge text components and construct boundaries of text instances.
  
  Args:
      link_thr (float): The edge score threshold. Defaults to 0.8.
      edge_len_thr (int or float): The edge length threshold. Defaults to 50.
      rescale_fields (list[str]): The bbox/polygon field names to
          be rescaled. If None, no rescaling will be performed. Defaults to
          [polygons'].
docstr: Remove isolated text components. This code was partially adapted
  from https://github.com/GXYM/DRRG licensed under the MIT license.
  
  Args:
      text_comps (ndarray): The text components.
      comp_pred_labels (ndarray): The clustering labels of text
          components.
  
  Returns:
      tuple(filtered_text_comps, comp_pred_labels):
  
      - filtered_text_comps (ndarray): The text components with isolated
        ones removed.
      - comp_pred_labels (ndarray): The clustering labels with labels of
        isolated text components removed.
docstr_tok: ["Remove","isolated","text","components",".","This","code","was","partially","adapted","from","https",":","\/\/github.com\/GXYM\/DRRG","licensed","under","the","MIT","license",".","Args",":","text_comps","(","ndarray",")",":","The","text","components",".","comp_pred_labels","(","ndarray",")",":","The","clustering","labels","of","text","components",".","Returns",":","tuple","(","filtered_text_comps",",","comp_pred_labels",")",":","-","filtered_text_comps","(","ndarray",")",":","The","text","components","with","isolated","ones","removed",".","-","comp_pred_labels","(","ndarray",")",":","The","clustering","labels","with","labels","of","isolated","text","components","removed","."]
code: def _remove_single(
      self, text_comps: ndarray, comp_pred_labels: ndarray
  ) -> Tuple[ndarray, ndarray]:
      """Remove isolated text components. This code was partially adapted
      from https://github.com/GXYM/DRRG licensed under the MIT license.
  
      Args:
          text_comps (ndarray): The text components.
          comp_pred_labels (ndarray): The clustering labels of text
              components.
  
      Returns:
          tuple(filtered_text_comps, comp_pred_labels):
  
          - filtered_text_comps (ndarray): The text components with isolated
            ones removed.
          - comp_pred_labels (ndarray): The clustering labels with labels of
            isolated text components removed.
      """
      assert text_comps.ndim == 2
      assert text_comps.shape[0] == comp_pred_labels.shape[0]
  
      single_flags = np.zeros_like(comp_pred_labels)
      pred_labels = np.unique(comp_pred_labels)
      for label in pred_labels:
          current_label_flag = comp_pred_labels == label
          if np.sum(current_label_flag) == 1:
              single_flags[np.where(current_label_flag)[0][0]] = 1
      keep_ind = [
          i for i in range(len(comp_pred_labels)) if not single_flags[i]
      ]
      filtered_text_comps = text_comps[keep_ind, :]
      filtered_labels = comp_pred_labels[keep_ind]
  
      return filtered_text_comps, filtered_labels
  
imports: import functools
  import operator
  from typing import Dict, List, Tuple, Union
  import cv2
  import numpy
  import torch
  from mmengine.structures import InstanceData
  from numpy import ndarray
  from mmocr.registry import MODELS
  from mmocr.structures import TextDetDataSample
  from .base import BaseTextDetPostProcessor
label_desc: Use image node_id 7 for calling the DRRGPostprocessor obj's underlying member method code with example usage: obj._remove_single(text_comps, comp_pred_labels) and returns: filtered_text_comps,  filtered_labels