Package edu.harvard.wcfia.yoshikoder.dictionary

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


                    name.getText().length()==0){
                throw new Exception(Messages.getString("noEntryName"));
            }
            String desc = description.getText();
            Double d = getScore();
            CategoryNode node =
                new CategoryNodeImpl(name.getText(), d, desc);
           
            if (!nodeToEdit.equals(node)){           
                yoshikoder.replaceNode(nodeToEdit, node);
                yoshikoder.setSelectedNode(node);
View Full Code Here


            if ((doc1 == null) || (doc2 == null)){
                return;           
            }
           
            Node n = yoshikoder.getSelectedNode();
            CategoryNode cnode = null;
            if (n instanceof CategoryNode)
              cnode = (CategoryNode)n;
            else // patternnode
              cnode = (CategoryNode)n.getParent();
            final CategoryNode catnode = cnode;
           
            dworker = new DialogWorker(yoshikoder){
                protected void doWork() throws Exception {
                    DocumentList dl = new DocumentListImpl();
                    dl.add(doc1);
                    dl.add(doc2);

                    TokenizationCache tcache = yoshikoder.getTokenizationCache();
                    TokenList tl1 = tcache.getTokenList(doc1);
                    TokenList tl2 = tcache.getTokenList(doc2);
                    if (tl1 == null){
                        tl1 = TokenizationService.getTokenizationService().tokenize(doc1);
                        tcache.putTokenList(doc1, tl1);
                    }
                    if (tl2 == null){
                        tl2 = TokenizationService.getTokenizationService().tokenize(doc2);
                        tcache.putTokenList(doc2, tl2);
                    }
                   
                    //YKDictionary dict = yoshikoder.getDictionary();
                    EntryFrequencyMap efm1 = new EntryFrequencyMap(catnode, tl1);
                    EntryFrequencyMap efm2 = new EntryFrequencyMap(catnode, tl2);
                   
                    String key = doc1.getTitle() +
                        " vs. " + doc2.getTitle();
                    DictionaryRRDocumentComparisonReport report =
                        new DictionaryRRDocumentComparisonReport(key,
                                key,
                                catnode.getName(), dl, efm1, efm2);
                   
                    System.err.println(report==null);
                    dia = new YKReportDialog(yoshikoder, report);
                }
                protected void onError() {
View Full Code Here

        return sb.toString();
    }
   
    protected static void recurseHTML(Node n, StringBuffer sb){
        if (n instanceof CategoryNode){
            CategoryNode cn = (CategoryNode)n;          
            sb.append(toHTML(cn));
            sb.append("<ul>\n");
            Enumeration<Node> en = cn.children();
            while (en.hasMoreElements()){
                Node child = en.nextElement();
                recurseHTML(child, sb);
            }
            sb.append("</ul>\n");
View Full Code Here

        fout.close();       
    }   
   
    protected static void recurse(Node n, StringBuffer sb){
        if (n instanceof CategoryNode){
            CategoryNode cn = (CategoryNode)n;
            sb.append(toXML(cn));
            Enumeration<Node> en = cn.children();
            while (en.hasMoreElements()){
                Node child = en.nextElement();
                recurse(child, sb);
            }
            sb.append("</cnode>\n");
View Full Code Here

                    //
                }
            }
            String desc = attributes.getValue("desc");
           
            CategoryNode cn = new CategoryNodeImpl(name, d, desc);
            if (isRoot){   
                stack.push(cn);
                dict.setDictionaryRoot(cn);
                isRoot = false;
            } else {
View Full Code Here

                    //
                }
            }
            String desc = attributes.getValue("desc");
           
            CategoryNode cn = new CategoryNodeImpl(name, d, desc);
            if (isRoot){   
              stack.push(cn);
                dict.setDictionaryRoot(cn);
              isRoot = false
            } else {
View Full Code Here

            if (!style.equals("041204")) //$NON-NLS-1$
                throw new SAXException(Messages.getString("wrongFormat")); //$NON-NLS-1$
       
        } else if (qName.equals("category")){ //$NON-NLS-1$
           
            CategoryNode newcat = new CategoryNodeImpl("Nameless"); //$NON-NLS-1$
            if (stack.size()==0){ // this is root
                dict.setDictionaryRoot(newcat);
            } else {
                CategoryNode cparent = (CategoryNode)stack.peek();
                try {
                    dict.addCategory(newcat, cparent);
                } catch (DuplicateException de){
                    throw new SAXException(de);
                }
            }
            stack.push(newcat);
            inPattern = false;
            
        } else if (qName.equals("pattern")){ //$NON-NLS-1$
            PatternNode newpat = new PatternNodeImpl("Nameless"); //$NON-NLS-1$
            CategoryNode cparent = (CategoryNode)stack.peek();
            try {
                dict.addPattern(newpat, cparent);
            } catch (DuplicateException de){
                throw new SAXException(de);
            }   
View Full Code Here

            } catch (NumberFormatException nfe){
                throw new SAXException(nfe);
            }
           
        } else if (qName.equals("comment")){ //$NON-NLS-1$
            CategoryNode node = (CategoryNode)stack.peek();
            node.setDescription(sb.toString());
           
        } else if (qName.equals("category")){ //$NON-NLS-1$
          stack.pop();
     
        } else if (qName.equals("pattern")){ //$NON-NLS-1$
View Full Code Here

        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();
View Full Code Here

    public void actionPerformed(ActionEvent e) {
        final YKDocument doc = yoshikoder.getSelectedDocument();
        if (doc == null) return;
       
        Node n = yoshikoder.getSelectedNode();
        CategoryNode cnode = null;
        if (n instanceof CategoryNode)
          cnode = (CategoryNode)n;
        else // patternnode
          cnode = (CategoryNode)n.getParent();
        final CategoryNode catnode = cnode;
       
        TaskWorker tworker = new TaskWorker(yoshikoder){
            YKDictionaryReportDialog dia;
          protected void doWork() throws Exception {
                TokenizationCache tcache = yoshikoder.getTokenizationCache();
View Full Code Here

TOP

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

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.