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>
docstr: Attempt to initialize Stanford Word Segmenter for the specified language
  using the STANFORD_SEGMENTER and STANFORD_MODELS environment variables
docstr_tok: ["Attempt","to","initialize","Stanford","Word","Segmenter","for","the","specified","language","using","the","STANFORD_SEGMENTER","and","STANFORD_MODELS","environment","variables"]
code: def default_config(self, lang):
      """
      Attempt to initialize Stanford Word Segmenter for the specified language
      using the STANFORD_SEGMENTER and STANFORD_MODELS environment variables
      """
  
      search_path = ()
      if os.environ.get("STANFORD_SEGMENTER"):
          search_path = {
              os.path.join(os.environ.get("STANFORD_SEGMENTER"), "data")
          }
  
      # init for Chinese-specific files
      self._dict = None
      self._sihan_corpora_dict = None
      self._sihan_post_processing = "false"
  
      if lang == "ar":
          self._java_class = "edu.stanford.nlp.international.arabic.process.ArabicSegmenter"
          model = "arabic-segmenter-atb+bn+arztrain.ser.gz"
  
      elif lang == "zh":
          self._java_class = "edu.stanford.nlp.ie.crf.CRFClassifier"
          model = "pku.gz"
          self._sihan_post_processing = "true"
  
          path_to_dict = "dict-chris6.ser.gz"
          try:
              self._dict = find_file(
                  path_to_dict,
                  searchpath=search_path,
                  url=_stanford_url,
                  verbose=False,
                  env_vars=("STANFORD_MODELS",),
              )
          except LookupError as e:
              raise LookupError(
                  "Could not find '%s' (tried using env. "
                  "variables STANFORD_MODELS and <STANFORD_SEGMENTER>/data/)"
                  % path_to_dict
              ) from e
  
          sihan_dir = "./data/"
          try:
              path_to_sihan_dir = find_dir(
                  sihan_dir,
                  url=_stanford_url,
                  verbose=False,
                  env_vars=("STANFORD_SEGMENTER",),
              )
              self._sihan_corpora_dict = os.path.join(
                  path_to_sihan_dir, sihan_dir
              )
          except LookupError as e:
              raise LookupError(
                  "Could not find '%s' (tried using the "
                  "STANFORD_SEGMENTER environment variable)" % sihan_dir
              ) from e
      else:
          raise LookupError(f"Unsupported language {lang}")
  
      try:
          self._model = find_file(
              model,
              searchpath=search_path,
              url=_stanford_url,
              verbose=False,
              env_vars=("STANFORD_MODELS", "STANFORD_SEGMENTER"),
          )
      except LookupError as e:
          raise LookupError(
              "Could not find '%s' (tried using env. "
              "variables STANFORD_MODELS and <STANFORD_SEGMENTER>/data/)"
              % model
          ) from e
  
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 2 for calling the StanfordSegmenter obj's underlying member method code with example usage: obj.default_config(lang) without return types