Package edu.harvard.wcfia.yoshikoder.dictionary

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


 
  protected PropertyChangeSupport pceListeners =
      new PropertyChangeSupport(this);
 
  public YKProject(String pname, String pdesc, DocumentList dlist){
      dictionary = new SimpleDictionary(pname);     
      documentList = dlist;
      setDescription(pdesc);
  }
View Full Code Here


      documentList = dlist;
      setDescription(pdesc);
  }
 
  public YKProject(String pname, String pdesc){
      dictionary = new SimpleDictionary(pname);
      setDescription(pdesc);
      documentList = new DocumentListImpl();
  }
View Full Code Here

      documentList = new DocumentListImpl();
  }
 
    public YKProject() {
        documentList = new DocumentListImpl();
        dictionary = new SimpleDictionary();
        setName("Untitled"); //$NON-NLS-1$
        setDescription("New dictionary"); //$NON-NLS-1$
    }
View Full Code Here

    public void startElement(String uri, String localName, String qName,
            Attributes attributes) throws SAXException{
       
        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)
View Full Code Here

     *
     */
    public YKOldDictionaryHandler() {
        super();
        stack = new Stack();
        dict = new SimpleDictionary();
        engine = dict.getPatternEngine();
        sb = new StringBuffer();
    }
View Full Code Here

              proj.setDisplayFont(Font.decode(fnt));
            }
             
        } 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");
View Full Code Here

        return dict;
    }
   
    public YKDictionary parse(String s) {
        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));
                    } catch (Exception re) {
                        errors.add(new BadPattern(lineNumber, trimmed, false));
                    }
View Full Code Here

TOP

Related Classes of edu.harvard.wcfia.yoshikoder.dictionary.SimpleDictionary

Copyright © 2018 www.massapicom. 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.