Examples of CategoryNode


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

 
  protected void writeExcel(List<YKDocument> documents, File file, CategoryNode node) throws Exception {
    final List<YKDocument> docs = documents;
    final File outputFile = file;
    final FileOutputStream stream = new FileOutputStream(outputFile);       
    final CategoryNode catnode = node;
   
    tworker = new TaskWorker(yoshikoder){
            protected void doWork() throws Exception {
              // FIRST DOC
              YKDocument doc1 = (YKDocument)docs.get(0);
View Full Code Here

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

  protected void writeCsvUTF8(List<YKDocument> documents, File file, CategoryNode node) throws Exception {
    final List<YKDocument> docs = documents;
    final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file),
        Charset.forName("UTF8")));
    final CategoryNode catnode = node;
   
    tworker = new TaskWorker(yoshikoder){
            protected void doWork() throws Exception {
              // FIRST DOC
              YKDocument doc1 = (YKDocument)docs.get(0);
View Full Code Here

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

 
    public void actionPerformed(ActionEvent e) {
        if (yoshikoder.getProject().getDocumentList().size() > 1){

          Node n = yoshikoder.getSelectedNode();
            CategoryNode cnode = null;
            if (n instanceof CategoryNode)
              cnode = (CategoryNode)n;
            else // patternnode
              cnode = (CategoryNode)n.getParent();
            final CategoryNode catnode = cnode;
         
          File file;
          try {
            int resp = chooser.showSaveDialog(yoshikoder);
            if (resp != JFileChooser.APPROVE_OPTION)
View Full Code Here

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

        final Map<YKDocument,Concordance> concmap = yoshikoder.getDocumentConcordanceMap();
        if (concmap == null || concmap.size()==0)
          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;
          Map<YKDocument,EntryFrequencyMap> efmMap;
           
          protected void doWork() throws Exception {
            EntryFrequencyMap efm = null;
            for (YKDocument doc : concmap.keySet()) {
              TokenList tlist = new TokenListImpl();
              Concordance conc = concmap.get(doc);
              for (Iterator iter = conc.iterator(); iter.hasNext();) {
                ConcordanceLine line = (ConcordanceLine) iter.next();
                for (Iterator iterator = line.getLeftHandSide().iterator(); iterator.hasNext();) {
                  Token token = (Token) iterator.next();
                  tlist.add(token);
                }
                for (Iterator iterator = line.getRightHandSide().iterator(); iterator.hasNext();) {
                  Token token = (Token) iterator.next();
                  tlist.add(token);
                }
              }
              efm = new EntryFrequencyMap(yoshikoder.getDictionary(), tlist);
              efmMap.put(doc, efm);
            }
           
            // FIXME use efmMap in the report, not the most recent one!
           
            YKDocument fake =
                    YKDocumentFactory.createDummyDocument("Concordance", "none", "UTF-8");
                DictionaryFrequencyReport reportcatsonly =
                    new DictionaryFrequencyReport("Concordance Report",
                            catnode.getName() + " applied to current concordance",
                            yoshikoder.getDictionary().getName(),
                            fake, efm, false);
                DictionaryFrequencyReport reportcatsandpats =
                    new DictionaryFrequencyReport("Concordance Report",
                        catnode.getName() + "applied to current concordance",
                            yoshikoder.getDictionary().getName(),
                            fake, efm, true);
                dia = new YKDictionaryReportDialog(yoshikoder, reportcatsonly, reportcatsandpats, onlyShowCats);
            }
            protected void onSuccess() {
View Full Code Here

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

                throw new Exception(Messages.getString("noEntryName")); //$NON-NLS-1$
            }
            Double d = getScore();
            String desc = description.getText();
           
            CategoryNode node =
                new CategoryNodeImpl(name.getText(), d, desc)
            yoshikoder.addCategory(node, parent);
            yoshikoder.setSelectedNode(node);
            yoshikoder.setUnsavedChanges(true);
View Full Code Here

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

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

            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

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

        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

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

        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

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

                    //
                }
            }
            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
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.