def segment(self, source, language=None):
    """Returns a chunk list from the given sentence.

    Args:
      source (str): Source string to segment.
      language (:obj:`str`, optional): A language code.

    Returns:
      A chunk list. (:obj:`budou.chunk.ChunkList`)

    Raises:
      ValueError: If :obj:`language` is given and it is not included in
                  :obj:`supported_languages`.
    """
    if language and not language in self.supported_languages:
      raise ValueError(
          'Language {} is not supported by NLAPI segmenter'.format(language))

    chunks, language = self._get_source_chunks(source, language=language)
    if self.use_entity:
      entities = self._get_entities(source, language=language)
      chunks = self._group_chunks_by_entities(chunks, entities)
    chunks.resolve_dependencies()
    return chunks
def segment ( self , source , language = None ) : if language and not language in self . supported_languages : raise ValueError ( 'Language {} is not supported by NLAPI segmenter' . format ( language ) ) chunks , language = self . _get_source_chunks ( source , language = language ) if self . use_entity : entities = self . _get_entities ( source , language = language ) chunks = self . _group_chunks_by_entities ( chunks , entities ) chunks . resolve_dependencies ( ) return chunks
Returns a chunk list from the given sentence.

    Args:
      source (str): Source string to segment.
      language (:obj:`str`, optional): A language code.

    Returns:
      A chunk list. (:obj:`budou.chunk.ChunkList`)

    Raises:
      ValueError: If :obj:`language` is given and it is not included in
                  :obj:`supported_languages`.