code: @Override
    public List<String> tokenize(String text) {
      // TODO: find a cleaner implementation, this is a hack
  
      String replaced = text.replaceAll(
          "(?<!')\\b([a-zA-ZĉĝĥĵŝŭĈĜĤĴŜŬ]+)'(?![a-zA-ZĉĝĥĵŝŭĈĜĤĴŜŬ-])",
          "$1\u0001\u0001EO@APOS1\u0001\u0001").replaceAll(
              "(?<!')\\b([a-zA-ZĉĝĥĵŝŭĈĜĤĴŜŬ]+)'(?=[a-zA-ZĉĝĥĵŝŭĈĜĤĴŜŬ-])",
              "$1\u0001\u0001EO@APOS2\u0001\u0001 ");
      List<String> tokenList = super.tokenize(replaced);
      List<String> tokens = new ArrayList<>();
  
      // Put back apostrophes and remove spurious spaces.
      Iterator<String> itr = tokenList.iterator();
      while (itr.hasNext()) {
        String word = itr.next();
        if (word.endsWith("\u0001\u0001EO@APOS2\u0001\u0001")) {
          itr.next(); // Skip the next spurious white space.
        }
        word = word.replace("\u0001\u0001EO@APOS1\u0001\u0001", "'")
                   .replace("\u0001\u0001EO@APOS2\u0001\u0001", "'");
        tokens.add(word);
      }
      return tokens;
    }
docs: Tokenizes just like WordTokenizer with the exception that words
  such as "dank'" contain an apostrophe within it.
  
  @param text
  - Text to tokenize
  @return List of tokens.
  
  Note: a special string \u0001\u0001EO@APOS\u0001\u0001 is used to replace apostrophe
  during tokenizing.