@@ -0,0 +1,2836 @@
+package com.github.jacopofar.fleximatcherwebinterface;%0Aimport com.github.jacopofar.fleximatcher.FlexiMatcher;%0Aimport com.github.jacopofar.fleximatcher.annotations.MatchingResults;%0Aimport com.github.jacopofar.fleximatcher.annotations.TextAnnotation;%0Aimport com.github.jacopofar.fleximatcher.importer.FileTagLoader;%0Aimport org.json.JSONObject;%0A%0Aimport java.io.FileWriter;%0Aimport java.io.IOException;%0Aimport java.util.LinkedList;%0A%0Aimport static spark.Spark.*;%0A%0A/**%0A * A simple example just showing some basic functionality%0A */%0Apublic class Fwi %7B%0A    private static FlexiMatcher fm;%0A    private static FileWriter fwTag;%0A    private static int tagCount=0;%0A%0A    public static void main(String%5B%5D args) throws IOException %7B%0A%0A        System.out.println(%22starting matcher...%22);%0A        fm = new FlexiMatcher();%0A%0A        /*%0A        fm.bind(%22it-pos%22, new ItPosRuleFactory(im));%0A        fm.bind(%22it-token%22, new ItTokenRuleFactory(im));%0A        fm.bind(%22it-verb-conjugated%22, new ItSpecificVerbRuleFactory(im));%0A        fm.bind(%22it-verb-form%22, new ItVerbFormRuleFactory(im));%0A        */%0A        String fname=%22rule_list.tsv%22;%0A        FileTagLoader.readTagsFromTSV(fname, fm);%0A%0A        fwTag=new FileWriter(fname,true);%0A%0A%0A        staticFiles.externalLocation(%22static%22);%0A%0A        //staticFiles.externalLocation(%22/static%22);%0A        //  port(5678); %3C- Uncomment this if you want spark to listen to port 5678 in stead of the default 4567%0A%0A        get(%22/parse%22, (request, response) -%3E %7B%0A%0A            JSONObject retVal = new JSONObject();%0A            String text = request.queryMap().get(%22text%22).value();%0A            String pattern = request.queryMap().get(%22pattern%22).value();%0A            System.out.println(text+%22 -- %22+pattern);%0A            MatchingResults results;%0A            try%7B%0A                long start=System.currentTimeMillis();%0A                results = fm.matches(text, pattern, FlexiMatcher.getDefaultAnnotator(), true, false, true);%0A                retVal.put(%22time_to_parse%22, System.currentTimeMillis()-start);%0A            %7D%0A            catch(RuntimeException r)%7B%0A                System.out.println(r.getMessage());%0A                r.printStackTrace();%0A                return %22%7B%5C%22error%5C%22:%22+JSONObject.quote(r.getMessage())+%22%7D%22;%0A            %7D%0A            System.out.println(results.toString());%0A            retVal.put(%22is_matching%22, results.isMatching());%0A            retVal.put(%22empty_match%22, results.isEmptyMatch());%0A            for(LinkedList%3CTextAnnotation%3E interpretation:results.getAnnotations().get())%7B%0A                JSONObject addMe = new JSONObject();%0A%0A                for(TextAnnotation v:interpretation)%7B%0A                    addMe.append(%22annotations%22, new JSONObject(v.toJSON()));%0A                %7D%0A                retVal.append(%22interpretations%22, addMe);%0A            %7D%0A%0A            return retVal.toString();%0A        %7D);%0A%0A%0A%0A    %7D%0A%7D

use a proper package name