class_docstr: Text modality
  
  Parameters
  ----------
  corpus: List[str], default = None
      List of user/item texts that the indices are aligned with `ids`.
  
  ids: List, default = None
      List of user/item ids that the indices are aligned with `corpus`.
      If None, the indices of provided `corpus` will be used as `ids`.
  
  tokenizer: Tokenizer, optional, default = None
      Tokenizer for text splitting. If None, the BaseTokenizer will be used.
  
  vocab: Vocabulary, optional, default = None
      Vocabulary of tokens. It contains mapping between tokens to their
      integer ids and vice versa.
  
  max_vocab: int, optional, default = None
      The maximum size of the vocabulary.
      If vocab is provided, this will be ignored.
  
  max_doc_freq: float in range [0.0, 1.0] or int, default=1.0
      When building the vocabulary ignore terms that have a document
      frequency strictly higher than the given threshold (corpus-specific
      stop words).
      If float, the value represents a proportion of documents, int for absolute counts.
      If `vocab` is not None, this will be ignored.
  
  min_doc_freq: float in range [0.0, 1.0] or int, default=1
      When building the vocabulary ignore terms that have a document
      frequency strictly lower than the given threshold. This value is also
      called cut-off in the literature.
      If float, the value represents a proportion of documents, int absolute counts.
      If `vocab` is not None, this will be ignored.
  
  tfidf_params: dict or None, optional, default=None
      If `None`, a default arguments of :obj:`<cornac.data.text.IfidfVectorizer>` will be used.
      List of parameters:
  
      'binary' : boolean, default=False
          If True, all non zero counts are set to 1.
      'norm' : 'l1', 'l2' or None, optional, default='l2'
          Each output row will have unit norm, either:
          * 'l2': Sum of squares of vector elements is 1. The cosine
          similarity between two vectors is their dot product when l2 norm has
          been applied.
          * 'l1': Sum of absolute values of vector elements is 1.
          See :func:`utils.common.normalize`
      'use_idf' : boolean, default=True
          Enable inverse-document-frequency reweighting.
      'smooth_idf' : boolean, default=True
          Smooth idf weights by adding one to document frequencies, as if an
          extra document was seen containing every term in the collection
          exactly once. Prevents zero divisions.
      'sublinear_tf' : boolean (default=False)
          Apply sublinear tf scaling, i.e. replace tf with 1 + log(tf).
class_docstr_tok: ["Text","modality","Parameters","--","--","--","--","--","corpus",":","List","[","str","]",",","default","=","None","List","of","user\/item","texts","that","the","indices","are","aligned","with","`","ids","`",".","ids",":","List",",","default","=","None","List","of","user\/item","ids","that","the","indices","are","aligned","with","`","corpus","`",".","If","None",",","the","indices","of","provided","`","corpus","`","will","be","used","as","`","ids","`",".","tokenizer",":","Tokenizer",",","optional",",","default","=","None","Tokenizer","for","text","splitting",".","If","None",",","the","BaseTokenizer","will","be","used",".","vocab",":","Vocabulary",",","optional",",","default","=","None","Vocabulary","of","tokens",".","It","contains","mapping","between","tokens","to","their","integer","ids","and","vice","versa",".","max_vocab",":","int",",","optional",",","default","=","None","The","maximum","size","of","the","vocabulary",".","If","vocab","is","provided",",","this","will","be","ignored",".","max_doc_freq",":","float","in","range","[","0.0",",","1.0","]","or","int",",","default=1.0","When","building","the","vocabulary","ignore","terms","that","have","a","document","frequency","strictly","higher","than","the","given","threshold","(","corpus-specific","stop","words",")",".","If","float",",","the","value","represents","a","proportion","of","documents",",","int","for","absolute","counts",".","If","`","vocab","`","is","not","None",",","this","will","be","ignored",".","min_doc_freq",":","float","in","range","[","0.0",",","1.0","]","or","int",",","default=1","When","building","the","vocabulary","ignore","terms","that","have","a","document","frequency","strictly","lower","than","the","given","threshold",".","This","value","is","also","called","cut-off","in","the","literature",".","If","float",",","the","value","represents","a","proportion","of","documents",",","int","absolute","counts",".","If","`","vocab","`","is","not","None",",","this","will","be","ignored",".","tfidf_params",":","dict","or","None",",","optional",",","default=None","If","`","None","`",",","a","default","arguments","of",":","obj",":","`","<","cornac.data.text.IfidfVectorizer",">","`","will","be","used",".","List","of","parameters",":","'binary","'",":","boolean",",","default=False","If","True",",","all","non","zero","counts","are","set","to","1",".","'norm","'",":","'l1","'",",","'l2","'","or","None",",","optional",",","default='l2'","Each","output","row","will","have","unit","norm",",","either",":","*","'l2","'",":","Sum","of","squares","of","vector","elements","is","1",".","The","cosine","similarity","between","two","vectors","is","their","dot","product","when","l2","norm","has","been","applied",".","*","'l1","'",":","Sum","of","absolute","values","of","vector","elements","is","1",".","See",":","func",":","`","utils.common.normalize","`","'use_idf","'",":","boolean",",","default=True","Enable","inverse-document-frequency","reweighting",".","'smooth_idf","'",":","boolean",",","default=True","Smooth","idf","weights","by","adding","one","to","document","frequencies",",","as","if","an","extra","document","was","seen","containing","every","term","in","the","collection","exactly","once",".","Prevents","zero","divisions",".","'sublinear_tf","'",":","boolean","(","default=False",")","Apply","sublinear","tf","scaling",",","i.e",".","replace","tf","with","1","+","log","(","tf",")","."]
docstr: Return a numpy matrix of text sequences containing token ids
  with size=(len(batch_ids), max_length).
  
  Parameters
  ----------
  batch_ids: Union[List, numpy.array], required
      An array containing the ids of rows of text sequences to be returned.
  
  max_length: int, optional
      Cut-off length of returned sequences.
      If `None`, it will be inferred based on retrieved sequences.
  
  Returns
  -------
  batch_sequences: numpy.ndarray
      Batch of sequences with zero-padding at the end.
docstr_tok: ["Return","a","numpy","matrix","of","text","sequences","containing","token","ids","with","size=","(","len","(","batch_ids",")",",","max_length",")",".","Parameters","--","--","--","--","--","batch_ids",":","Union","[","List",",","numpy.array","]",",","required","An","array","containing","the","ids","of","rows","of","text","sequences","to","be","returned",".","max_length",":","int",",","optional","Cut-off","length","of","returned","sequences",".","If","`","None","`",",","it","will","be","inferred","based","on","retrieved","sequences",".","Returns","--","--","--","-","batch_sequences",":","numpy.ndarray","Batch","of","sequences","with","zero-padding","at","the","end","."]
code: def batch_seq(self, batch_ids, max_length=None):
      """Return a numpy matrix of text sequences containing token ids
      with size=(len(batch_ids), max_length).
  
      Parameters
      ----------
      batch_ids: Union[List, numpy.array], required
          An array containing the ids of rows of text sequences to be returned.
  
      max_length: int, optional
          Cut-off length of returned sequences.
          If `None`, it will be inferred based on retrieved sequences.
  
      Returns
      -------
      batch_sequences: numpy.ndarray
          Batch of sequences with zero-padding at the end.
  
      """
      if self.sequences is None:
          raise ValueError("self.sequences is required but None!")
  
      if max_length is None:
          max_length = max(
              len(self.sequences[mapped_id]) for mapped_id in batch_ids
          )
  
      seq_mat = np.zeros((len(batch_ids), max_length), dtype="int")
      for i, mapped_id in enumerate(batch_ids):
          idx_seq = self.sequences[mapped_id][:max_length]
          for j, idx in enumerate(idx_seq):
              seq_mat[i, j] = idx
  
      return seq_mat
  
imports: from typing import List, Dict, Callable, Union
  from collections import defaultdict, Counter, OrderedDict
  import string
  import pickle
  import re
  import numpy
  import scipy.sparse
  from .None import FeatureModality
  from .modality import fallback_feature
  from ..utils import normalize
label_desc: Use image node_id 6 for calling the TextModality obj's underlying member method code with example usage: obj.batch_seq(batch_ids, max_length) and returns: seq_mat