class_docstr: TextSet wraps a set of texts with status.
class_docstr_tok: ["TextSet","wraps","a","set","of","texts","with","status","."]
docstr: Used to generate a TextSet for ranking.
  
  This method does the following:
  1. For each id1 in relations, find the list of id2 with corresponding label that
  comes together with id1.
  In other words, group relations by id1.
  2. Join with corpus to transform each id to indexedTokens.
  Note: Make sure that the corpus has been transformed by SequenceShaper and WordIndexer.
  3. For each list, generate a TextFeature having Sample with:
  - feature of shape (list_length, text1_length + text2_length).
  - label of shape (list_length, 1).
  
  :param relations: List or RDD of Relation.
  :param corpus1: TextSet that contains all id1 in relations. For each TextFeature in corpus1,
                  text must have been transformed to indexedTokens of the same length.
  :param corpus2: TextSet that contains all id2 in relations. For each TextFeature in corpus2,
                  text must have been transformed to indexedTokens of the same length.
  Note that if relations is a list, then corpus1 and corpus2 must both be LocalTextSet.
  If relations is RDD, then corpus1 and corpus2 must both be DistributedTextSet.
  
  :return: TextSet.
docstr_tok: ["Used","to","generate","a","TextSet","for","ranking",".","This","method","does","the","following",":","1",".","For","each","id1","in","relations",",","find","the","list","of","id2","with","corresponding","label","that","comes","together","with","id1",".","In","other","words",",","group","relations","by","id1",".","2",".","Join","with","corpus","to","transform","each","id","to","indexedTokens",".","Note",":","Make","sure","that","the","corpus","has","been","transformed","by","SequenceShaper","and","WordIndexer",".","3",".","For","each","list",",","generate","a","TextFeature","having","Sample","with",":","-","feature","of","shape","(","list_length",",","text1_length","+","text2_length",")",".","-","label","of","shape","(","list_length",",","1",")",".",":","param","relations",":","List","or","RDD","of","Relation",".",":","param","corpus1",":","TextSet","that","contains","all","id1","in","relations",".","For","each","TextFeature","in","corpus1",",","text","must","have","been","transformed","to","indexedTokens","of","the","same","length",".",":","param","corpus2",":","TextSet","that","contains","all","id2","in","relations",".","For","each","TextFeature","in","corpus2",",","text","must","have","been","transformed","to","indexedTokens","of","the","same","length",".","Note","that","if","relations","is","a","list",",","then","corpus1","and","corpus2","must","both","be","LocalTextSet",".","If","relations","is","RDD",",","then","corpus1","and","corpus2","must","both","be","DistributedTextSet",".",":","return",":","TextSet","."]
code: def from_relation_lists(
      cls, relations, corpus1, corpus2, bigdl_type="float"
  ):
      """
      Used to generate a TextSet for ranking.
  
      This method does the following:
      1. For each id1 in relations, find the list of id2 with corresponding label that
      comes together with id1.
      In other words, group relations by id1.
      2. Join with corpus to transform each id to indexedTokens.
      Note: Make sure that the corpus has been transformed by SequenceShaper and WordIndexer.
      3. For each list, generate a TextFeature having Sample with:
      - feature of shape (list_length, text1_length + text2_length).
      - label of shape (list_length, 1).
  
      :param relations: List or RDD of Relation.
      :param corpus1: TextSet that contains all id1 in relations. For each TextFeature in corpus1,
                      text must have been transformed to indexedTokens of the same length.
      :param corpus2: TextSet that contains all id2 in relations. For each TextFeature in corpus2,
                      text must have been transformed to indexedTokens of the same length.
      Note that if relations is a list, then corpus1 and corpus2 must both be LocalTextSet.
      If relations is RDD, then corpus1 and corpus2 must both be DistributedTextSet.
  
      :return: TextSet.
      """
      if isinstance(relations, RDD):
          relations = relations.map(lambda x: x.to_tuple())
      elif isinstance(relations, list):
          relations = [relation.to_tuple() for relation in relations]
      else:
          raise TypeError("relations should be RDD or list of Relation")
      jvalue = callZooFunc(
          bigdl_type,
          "textSetFromRelationLists",
          relations,
          corpus1,
          corpus2,
      )
      return TextSet(jvalue=jvalue)
  
imports: import six
  from bigdl.util.common import JavaValue
  from zoo.common.utils import callZooFunc
  from pyspark import RDD
label_desc: Use image node_id 27 for calling the TextSet obj's underlying member method code with example usage: obj.from_relation_lists(cls, relations, corpus1, corpus2, bigdl_type) and returns: TextSet