Package edu.harvard.wcfia.yoshikoder.dictionary

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


       
        NumberFormat nf = NumberFormat.getInstance();
        nf.setMaximumFractionDigits(4);
       
        for (Iterator iter = l.iterator(); iter.hasNext();) {
            Node node = (Node) iter.next();
           
            String entryPath =  comparison.getEntryPath(node);
            report[ii][0] = entryPath;
           
            RiskRatioStatistics rrs = comparison.getRiskRatioStatistics(node);
View Full Code Here


        }
       
        Object[][] report = new Object[l.size()][3];
        int ii=0;
        for (Iterator iter = l.iterator(); iter.hasNext();) {
            Node node = (Node) iter.next();
            //if (node.getParent()==null) // a root node - the dictionary name
            //   continue;
           
            String entryPath =  map.getEntryPath(node);
            report[ii][0] = entryPath;//.substring(entryPath.indexOf('>')+2, entryPath.length());
View Full Code Here

        comparisonMap = new HashMap();
   
        int total1 = m1.getTokenTotal();
        int total2 = m2.getTokenTotal();
        for (Iterator iter = m1.getSortedCategoryEntries().iterator(); iter.hasNext();) {
            Node node = (Node) iter.next();
            Integer count1 = m1.getEntryCount(node);
            Integer count2 = m2.getEntryCount(node);
            RiskRatioStatistics rrs =
                new RiskRatioStatistics(count1.intValue(), total1, count2.intValue(), total2);
            comparisonMap.put(node, rrs);
View Full Code Here

     * Returns a string representation of the full path of a dictionary entry.
     * @param n
     * @return full path
     */
    public String getEntryPath(Node n){
        Node parent = n;
        StringBuffer sb = new StringBuffer();
        sb.append(n.getName());
        while ((parent = (Node)parent.getParent()) != null){
            sb.insert(0, parent.getName() + ">");
        }
        return sb.toString();
    }
View Full Code Here

    }
   
    public String toString(){
        StringBuffer sb = new StringBuffer();
        for (Iterator iter = getSortedCategoryEntries().iterator(); iter.hasNext();) {
            Node node = (Node) iter.next();
            String path = getEntryPath(node);
            RiskRatioStatistics rrs = getRiskRatioStatistics(node);
            sb.append(path);
            sb.append(" ");
            sb.append(rrs.toString());
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 {
View Full Code Here

    public AddHighlightsAction(Yoshikoder yk) {
        super(yk, AddHighlightsAction.class.getName());
    }
   
    public void actionPerformed(ActionEvent e) {      
        Node n = yoshikoder.getSelectedNode();
        YKDocument doc = yoshikoder.getSelectedDocument();
        if (n == null || doc == null)
            return;
       
        TokenList toclist = null;
View Full Code Here

        Pattern[] pats = ((PatternNode)node).getPattern();
            int count = tl.countMatches(pats);
            nodeToCount.put(node, new Integer(count));

            // walk upwards, adding count to every parent
            Node parent = node;
            while ((parent = (Node)parent.getParent()) != currentTopNode){
              Integer c = nodeToCount.get(parent);

                Integer newCount = new Integer(c.intValue() + count);
                nodeToCount.put(parent, newCount);
            }
        } else {
            nodeToCount.put(node, new Integer(0));
        }
        // recurse
        Enumeration<Node> en = node.children();
        while (en.hasMoreElements()){
            Node n = en.nextElement();
            collectPatterns(n, tl);
        }
    }
View Full Code Here

   
    public List<Node> getSortedCategoryEntries(){
        List<Node> nl = getSortedEntries();
        List<Node> cats = new ArrayList<Node>();
        for (Iterator<Node> iter = nl.iterator(); iter.hasNext();) {
            Node node = iter.next();
            if (node instanceof CategoryNode)
                cats.add(node);
        }
        return cats;
    }
View Full Code Here

          d = new Double(0);
        return d;
    }
   
    public String getEntryPath(Node n){
        Node parent = n;
        StringBuffer sb = new StringBuffer();
        sb.append(n.getName());
        while ((parent = (Node)parent.getParent()) != null){
            sb.insert(0, parent.getName() + ">");
        }
        return sb.toString();
    }
View Full Code Here

TOP

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

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.