class_docstr: Coref Sample
class_docstr_tok: ["Coref","Sample"]
docstr: Given several CorefSamples, concat the values key by key.
  
  :param: Some CorefSamples
  :return ~textflint.input.component.sample.CorefSample:
      A CorefSample, as the docs are concanated to form one x
docstr_tok: ["Given","several","CorefSamples",",","concat","the","values","key","by","key",".",":","param",":","Some","CorefSamples",":","return","~textflint.input.component.sample.CorefSample",":","A","CorefSample",",","as","the","docs","are","concanated","to","form","one","x"]
code: def concat_conlls(*args):
      r"""
      Given several CorefSamples, concat the values key by key.
  
      :param: Some CorefSamples
      :return ~textflint.input.component.sample.CorefSample:
          A CorefSample, as the docs are concanated to form one x
  
      """
      if len(args) == 0:
          return CorefSample(data=None, origin=None)
      ret_coref_sample = CorefSample(data=None, origin=args[0])
      shift = 0
      for corefsam in args:
          if corefsam.doc_key != None:
              ret_coref_sample.doc_key = corefsam.doc_key
              break
      mask, x, sen_map, doc_sp = [], [], [], []
      clusters, constituents, ner = [], [], []
  
      for corefsam in args:
  
          @shift_decor
          def index_shift(word_idx):
              return word_idx + shift
  
          mask.extend(corefsam.x.mask)
          x.extend(corefsam.x.words)
          sen_map.extend(corefsam.sen_map)
          doc_sp.extend(corefsam.doc_sp.words)
          clusters.extend(
              recur_ap(index_shift, corefsam.clusters.field_value)
          )
          constituents.extend(
              recur_ap(index_shift, corefsam.constituents.field_value)
          )
          ner.extend(recur_ap(index_shift, corefsam.ner.field_value))
          shift += len(corefsam.x.words)
  
      ret_coref_sample.x = TextField(x, mask=mask)
      ret_coref_sample.sen_map = sen_map
      ret_coref_sample.doc_sp = TextField(doc_sp, mask=mask)
      ret_coref_sample.clusters = ListField(clusters)
      ret_coref_sample.constituents = ListField(constituents)
      ret_coref_sample.ner = ListField(ner)
  
      return ret_coref_sample
  
imports: from ....common.settings import ORIGIN, TASK_MASK
  from ....common.utils.fp_utils import *
  from ....common.utils.shift_utils import *
  from .sample import Sample
  from ..field import ListField, TextField
label_desc: Use image node_id 18 for calling the CorefSample obj's underlying member method code with example usage: obj.concat_conlls() and returns: ret_coref_sample, CorefSample, unknown