def chunk(str)
      raise ArgumentError, 'str must be a String' unless str.is_a?(String)

      tokens = tokenizer.tokenize(str)
      pos_tags = pos_tagger.tag(tokens).to_ary

      chunks = j_instance.chunk(tokens.to_java(:String), pos_tags.to_java(:String)).to_ary

      build_chunks(chunks, tokens, pos_tags)
    end
def chunk(str)
      raise ArgumentError, 'str must be a String' unless str.is_a?(String)

      tokens = tokenizer.tokenize(str)
      pos_tags = pos_tagger.tag(tokens).to_ary

      chunks = j_instance.chunk(tokens.to_java(:String), pos_tags.to_java(:String)).to_ary

      build_chunks(chunks, tokens, pos_tags)
    end
Initializes new instance of Chunker

 @param [OpenNlp::Model] model chunker model
 @param [Model::Tokenizer] token_model tokenizer model
 @param [Model::POSTagger] pos_model part-of-speech tagging model
 Chunks a string into part-of-sentence pieces

 @param [String] str string to chunk
 @return [Array] array of chunks with part-of-sentence information