class TokenExpressionFactory extends ExpressionFactory<ChunkTaggedToken> {

  private final boolean caseSensitive;

  /**
   * @param caseSensitive whether word tokens should be compared case-sensitively - also used for regular expressions
   */
  public TokenExpressionFactory(boolean caseSensitive) {
    this.caseSensitive = caseSensitive;
  }

  @Override
  public Expression.BaseExpression<ChunkTaggedToken> create(String expr) {<FILL_FUNCTION_BODY>}

}

    LogicExpression<ChunkTaggedToken> logicExpression = LogicExpression.compile(expr, input -> new TokenPredicate(input, caseSensitive));
    return new Expression.BaseExpression<ChunkTaggedToken>(expr) {
      @Override
      public boolean apply(ChunkTaggedToken token) {
        return logicExpression.apply(token);
      }
    };
  
<no_super_class>