code: public List<Tokenizer.Token> tokenize(String sentence) {
        Sequence seq = Sequence.create(Chars.asList(sentence.toCharArray())
                                            .stream()
                                            .map(Object::toString));
        Labeling labels = model.label(seq);
  
        int n = sentence.length();
        int[][] spans = new int[n + 1][2];
        double[] best = new double[n + 1];
        best[0] = 1d;
  
        for (int i = 1; i <= n; i++) {
           for (int j = Math.max(0, i - maxSpanSize); j < i; j++) {
              int w = i - j;
              String span = sentence.substring(j, j + w);
              double score = scoreWord(j, j + w, span, labels);
              double segmentScore = multi(best[i - w], score);
              logFiner("'{0}' > '{1}' : {2} : {3}",
                       sentence.substring(spans[i - w][0], spans[i - w][1]),
                       span,
                       segmentScore,
                       best[i]);
              if (segmentScore >= best[i]) {
                 best[i] = segmentScore;
                 spans[i][0] = j;
                 spans[i][1] = j + w;
              }
           }
        }
        int i = n;
        LinkedList<Tokenizer.Token> tokens = new LinkedList<>();
        while (i > 0) {
           String token = StringUtils.trim(sentence.substring(spans[i][0], spans[i][1]));
           if (!StringUtils.isNullOrBlank(token)) {
              tokens.addFirst(
                 new Tokenizer.Token(token, TokenType.UNKNOWN, spans[i][0], spans[i][0] + token.length(), 0));
           }
           i = i - (spans[i][1] - spans[i][0]);
        }
        i = 0;
        for (Tokenizer.Token token : tokens) {
           token.index = i;
           i++;
        }
  
        return tokens;
     }
docs: Tokenize list.
  
  @param sentence the sentence
  @return the list