def segment(self, source, language=None):
if language and not language in self.supported_languages:<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>'.format(language))<EOL><DEDENT>chunks, language = self._get_source_chunks(source, language=language)<EOL>if self.use_entity:<EOL><INDENT>entities = self._get_entities(source, language=language)<EOL>chunks = self._group_chunks_by_entities(chunks, entities)<EOL><DEDENT>chunks.resolve_dependencies()<EOL>return chunks<EOL>
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`.