Examples of PatternEngine


Examples of edu.harvard.wcfia.yoshikoder.dictionary.PatternEngine

       
        if (qName.equals("dictionary")){
           
            dict = new SimpleDictionary("nameless");
           
            PatternEngine peng = null;           
            // covers a late implementation change; used to be a classforName           
            String patengine = attributes.getValue("patternengineclassname");
            if (patengine != null)
                peng =
                    PatternEngineFactory.createEngine(PatternEngine.SUBSTRING);
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.dictionary.PatternEngine

        } else if (qName.equals("dictionary")){
           
            dict = new SimpleDictionary(proj.getName());
            System.err.println("setting up a fresh dictionary");

            PatternEngine peng = null;           
            // covers a late implementation change; used to be a classforName           
            String patengine = attributes.getValue("patternengineclassname");
            if (patengine != null)
              peng =
                PatternEngineFactory.createEngine(PatternEngine.SUBSTRING);
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.dictionary.PatternEngine

        errors = new ArrayList();
        YKDictionary dict = new SimpleDictionary();
       
        String newname = "Imported VBPro Dictionary";
        dict.getDictionaryRoot().setName(newname);
        PatternEngine rengine = dict.getPatternEngine();
        dict.setName(newname);
       
        BufferedReader in = new BufferedReader(new StringReader(s));
        String line;
        int ii=0;
        CategoryNode cat = null; // the current category
        int lineNumber = 0;
        try {
            while ((line = in.readLine()) != null) {
                lineNumber++;
                String trimmed = line.trim().toLowerCase();
                if (trimmed.startsWith(">") && trimmed.endsWith("<")) {
                    // a category
                    String categoryName = stripArrows(trimmed);
                   
                    if (categoryName.length() == 0) {
                        categoryName = "Entry_" + ii;
                        ii++;
                    }
                    cat = new CategoryNodeImpl(categoryName);
                    try {
                        dict.addCategory(cat, dict.getDictionaryRoot());
                    } catch (DuplicateException de){
                        errors.add(new BadPattern(lineNumber, trimmed, true));
                    }
                } else if (trimmed.length() > 0) {
                    // no need to fix these for a SubString match-using dictionary
                    //String fixed = fixVBProWildcards(trimmed);
                    try {
                        Pattern regexp = rengine.makeRegexp(trimmed);
                        PatternNode pattern =
                            new PatternNodeImpl(trimmed, null, regexp);
                        dict.addPattern(pattern, cat);
                    } catch (DuplicateException de){
                        errors.add(new BadPattern(lineNumber, trimmed, true));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.