code: def fromtext(cls, text, token_pattern=DEFAULT_TOKEN_PATTERN):
      # type: (str, str) -> SplitResult
      token_pattern = "(%s)" % token_pattern
      parts = re.split(token_pattern, text)
      return cls(parts)
  
imports: from __future__ import absolute_import
  import re
  import math
  from typing import List, Tuple, Union, Optional
  import numpy
  from sklearn.utils import check_random_state
  from eli5.utils import indices_to_bool_mask, vstack
label_desc: Use image node_id 2 for calling the SplitResult obj's underlying member method code with example usage: obj.fromtext(cls, text, token_pattern) and returns: cls