public ArrayList<Unit> toUnitList(String text) {
    ArrayList<Unit> tokens = new ArrayList<Unit>();
    /*
    String[] words = text.trim().split("[\\s]+");
    int offset = 0;
    for(String word : words){
      int begin = text.indexOf(word, offset);
      offset += word.length();
      Unit unit = new Unit(begin, begin + word.length(), word, "X");
      tokens.add(unit);
    }*/
    Annotation sentence = new Annotation(text);
    pipeline.annotate(sentence);
    int offset = 0;
    for (CoreLabel token : sentence.get(TokensAnnotation.class)) {
      String word = token.get(ValueAnnotation.class);      
      int begin = text.indexOf(word, offset);
      if(begin != -1){
        Unit unit = new Unit(begin, begin + word.length(), word, "X");
        offset += word.length();
        tokens.add(unit);
      }
      
    }
    return tokens;
  }