code: public static String[] textToWordSequence(String text, String filters, boolean lower, String split) {
          if (lower)
              text = text.toLowerCase();
  
          for (String filter: filters.split("")) {
              text = text.replace(filter, split);
          }
          String[] sequences = text.split(split);
          List<String> seqList = new ArrayList(Arrays.asList(sequences));
          seqList.removeAll(Arrays.asList("", null));
  
          return seqList.toArray(new String[seqList.size()]);
      }
docs: Turns a String text into a sequence of tokens.
  
  @param text                 input text
  @param filters              characters to filter
  @param lower                whether to lowercase input or not
  @param split                by which string to split words (usually single space)
  @return Sequence of tokens as String array