docstr: Get the word segmentation results with the texts as input
  
  Args:
       texts(list): the input texts to be segmented, if texts not data
       data(dict): key must be 'text', value is the texts to be segmented, if data not texts
       use_gpu(bool): whether use gpu to predict or not
       batch_size(int): the program deals once with one batch
       return_tag: Whether to get tag or not.
  
  Returns:
       results(list): the word segmentation results
docstr_tok: ["Get","the","word","segmentation","results","with","the","texts","as","input","Args",":","texts","(","list",")",":","the","input","texts","to","be","segmented",",","if","texts","not","data","data","(","dict",")",":","key","must","be","'text","'",",","value","is","the","texts","to","be","segmented",",","if","data","not","texts","use_gpu","(","bool",")",":","whether","use","gpu","to","predict","or","not","batch_size","(","int",")",":","the","program","deals","once","with","one","batch","return_tag",":","Whether","to","get","tag","or","not",".","Returns",":","results","(","list",")",":","the","word","segmentation","results"]
code: def lexical_analysis(
      self,
      texts=[],
      data={},
      use_gpu=False,
      batch_size=1,
      return_tag=True,
  ):
      """
      Get the word segmentation results with the texts as input
  
      Args:
           texts(list): the input texts to be segmented, if texts not data
           data(dict): key must be 'text', value is the texts to be segmented, if data not texts
           use_gpu(bool): whether use gpu to predict or not
           batch_size(int): the program deals once with one batch
           return_tag: Whether to get tag or not.
  
      Returns:
           results(list): the word segmentation results
      """
  
      if use_gpu:
          try:
              _places = os.environ["CUDA_VISIBLE_DEVICES"]
              int(_places[0])
          except:
              raise RuntimeError(
                  "Environment Variable CUDA_VISIBLE_DEVICES is not set correctly. If you wanna use gpu, please set CUDA_VISIBLE_DEVICES as cuda_device_id."
              )
  
      if texts != [] and isinstance(texts, list) and data == {}:
          predicted_data = texts
      elif (
          texts == []
          and isinstance(data, dict)
          and isinstance(data.get("text", None), list)
          and data["text"]
      ):
          predicted_data = data["text"]
      else:
          raise TypeError(
              "The input data is inconsistent with expectations."
          )
  
      predicted_data = self.to_unicode(predicted_data)
  
      # drop the empty string like "" in predicted_data
      empty_str_indexes = self._get_index(predicted_data)
      predicted_data = [data for data in predicted_data if data != ""]
  
      start_idx = 0
      iteration = int(math.ceil(len(predicted_data) / batch_size))
      results = []
      for i in range(iteration):
          if i < (iteration - 1):
              batch_data = predicted_data[
                  start_idx : (start_idx + batch_size)
              ]
          else:
              batch_data = predicted_data[start_idx:]
  
          start_idx = start_idx + batch_size
          data, lod, shape = self.preprocess(batch_data)
  
          predictor = (
              self.gpu_predictor if use_gpu else self.cpu_predictor
          )
          input_names = predictor.get_input_names()
          input_handle = predictor.get_input_handle(input_names[0])
          input_handle.copy_from_cpu(data)
          input_handle.set_lod(lod)
          input_handle.reshape(shape)
  
          predictor.run()
          output_names = predictor.get_output_names()
          output_handle = predictor.get_output_handle(output_names[0])
  
          batch_result = parse_result(
              batch_data,
              output_handle,
              self.id2label_dict,
              interventer=self.custom,
          )
          results += batch_result
  
      for index in empty_str_indexes:
          results.insert(index, {"word": [""], "tag": [""]})
  
      if not return_tag:
          for result in results:
              result = result.pop("tag")
          return results
  
      return results
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import argparse
  import ast
  import io
  import math
  import os
  import numpy
  import six
  from paddle.inference import Config
  from paddle.inference import create_predictor
  from .custom import Customization
  from .processor import load_kv_dict
  from .processor import parse_result
  from .processor import word_to_ids
  from paddlehub.module.module import moduleinfo
  from paddlehub.module.module import runnable
  from paddlehub.module.module import serving
  from paddlehub.utils.parser import txt_parser
  from paddlehub.utils.utils import sys_stdin_encoding
label_desc: Use image node_id 9 for calling the LAC obj's underlying member method code with example usage: obj.lexical_analysis(texts, data, use_gpu, batch_size, return_tag) and returns: results, results