class_docstr: Interface to the Stanford Segmenter
  
  If stanford-segmenter version is older than 2016-10-31, then path_to_slf4j
  should be provieded, for example::
  
      seg = StanfordSegmenter(path_to_slf4j='/YOUR_PATH/slf4j-api.jar')
  
  >>> from nltk.tokenize.stanford_segmenter import StanfordSegmenter
  >>> seg = StanfordSegmenter() # doctest: +SKIP
  >>> seg.default_config('zh') # doctest: +SKIP
  >>> sent = u'这是斯坦福中文分词器测试'
  >>> print(seg.segment(sent)) # doctest: +SKIP
  这 是 斯坦福 中文 分词器 测试
  <BLANKLINE>
  >>> seg.default_config('ar') # doctest: +SKIP
  >>> sent = u'هذا هو تصنيف ستانفورد العربي للكلمات'
  >>> print(seg.segment(sent.split())) # doctest: +SKIP
  هذا هو تصنيف ستانفورد العربي ل الكلمات
  <BLANKLINE>
code: def __init__(
      self,
      path_to_jar=None,
      path_to_slf4j=None,
      java_class=None,
      path_to_model=None,
      path_to_dict=None,
      path_to_sihan_corpora_dict=None,
      sihan_post_processing="false",
      keep_whitespaces="false",
      encoding="UTF-8",
      options=None,
      verbose=False,
      java_options="-mx2g",
  ):
      # Raise deprecation warning.
      warnings.simplefilter("always", DeprecationWarning)
      warnings.warn(
          str(
              "\nThe StanfordTokenizer will "
              "be deprecated in version 3.2.5.\n"
              "Please use \033[91mnltk.parse.corenlp.CoreNLPTokenizer\033[0m instead.'"
          ),
          DeprecationWarning,
          stacklevel=2,
      )
      warnings.simplefilter("ignore", DeprecationWarning)
  
      stanford_segmenter = find_jar(
          self._JAR,
          path_to_jar,
          env_vars=("STANFORD_SEGMENTER",),
          searchpath=(),
          url=_stanford_url,
          verbose=verbose,
      )
      if path_to_slf4j is not None:
          slf4j = find_jar(
              "slf4j-api.jar",
              path_to_slf4j,
              env_vars=("SLF4J", "STANFORD_SEGMENTER"),
              searchpath=(),
              url=_stanford_url,
              verbose=verbose,
          )
      else:
          slf4j = None
  
      # This is passed to java as the -cp option, the old version of segmenter needs slf4j.
      # The new version of stanford-segmenter-2016-10-31 doesn't need slf4j
      self._stanford_jar = os.pathsep.join(
          _ for _ in [stanford_segmenter, slf4j] if _ is not None
      )
  
      self._java_class = java_class
      self._model = path_to_model
      self._sihan_corpora_dict = path_to_sihan_corpora_dict
      self._sihan_post_processing = sihan_post_processing
      self._keep_whitespaces = keep_whitespaces
      self._dict = path_to_dict
  
      self._encoding = encoding
      self.java_options = java_options
      options = {} if options is None else options
      self._options_cmd = ",".join(
          f"{key}={json.dumps(val)}" for key, val in options.items()
      )
  
file_path: nltk/nltk/tokenize/stanford_segmenter.py
imports: import json
  import os
  import tempfile
  import warnings
  from subprocess import PIPE
  from nltk.internals import _java_options, config_java, find_dir, find_file, find_jar, java
  from nltk.tokenize.api import TokenizerI
label_desc: Use image node_id 1 to create a new StanfordSegmenter object from inherited base classes: TokenizerI with example: obj = StanfordSegmenter(path_to_jar, path_to_slf4j, java_class, path_to_model, path_to_dict, path_to_sihan_corpora_dict, sihan_post_processing, keep_whitespaces, encoding, options, verbose, java_options)