Examples of EntryFrequencyMap


Examples of edu.harvard.wcfia.yoshikoder.reporting.EntryFrequencyMap

      sb.append(" ");
    }
    // tokenize and apply dictionary to the 'document'
    YKDocument doc = new YKDocumentImpl(docTitle, sb.toString());
    TokenList tl = TokenizationService.getTokenizationService().tokenize(doc);
    EntryFrequencyMap efm1 = new EntryFrequencyMap(catnode, tl);

    int[] counts = new int[keys.length+1];
    for (int ii=0; ii<keys.length; ii++) {
      Integer cnt = (Integer) efm1.getEntryCount(keys[ii]);
      counts[ii] = cnt.intValue();
    }
    // add N
    counts[keys.length] = efm1.getTokenTotal();

    return counts;
  }
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.reporting.EntryFrequencyMap

        TokenList tl1 = tcache.getTokenList(doc1);
        if (tl1 == null)
          tl1 = TokenizationService.getTokenizationService().tokenize(doc1);
       
        // for _all_ categories
        EntryFrequencyMap efm1 = new EntryFrequencyMap(dict.getDictionaryRoot(), tl1);
        List lkeys = efm1.getSortedCategoryEntries();
        Node[] keys = (Node[])lkeys.toArray(new Node[lkeys.size()]);
        int[] counts = new int[keys.length+1];
        for (int ii=0; ii<keys.length; ii++) {
          Integer cnt = (Integer) efm1.getEntryCount(keys[ii]);
          counts[ii] = cnt.intValue();
        }
        // add N
        counts[keys.length] = efm1.getTokenTotal();

        HSSFWorkbook wb = new HSSFWorkbook();
        HSSFRow row;
        HSSFCell cell;

        HSSFSheet sheet = wb.createSheet("Category frequencies");

        // header
        row = sheet.createRow((short)0);
        for (int c=0; c<keys.length; c++){
          cell = row.createCell((short)(c+1));
          cell.setEncoding(HSSFCell.ENCODING_UTF_16);
          String nodepath = efm1.getEntryPath(keys[c]);
          cell.setCellValue(nodepath);
        }
        cell = row.createCell((short)(keys.length+1));
        cell.setEncoding(HSSFCell.ENCODING_UTF_16);
        cell.setCellValue("Total");
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.reporting.EntryFrequencyMap

        TokenList tl1 = tcache.getTokenList(doc1);
        if (tl1 == null)
          tl1 = TokenizationService.getTokenizationService().tokenize(doc1);

        // compute the dictionary counts
        EntryFrequencyMap efm1 = new EntryFrequencyMap(dict.getDictionaryRoot(), tl1);
        List lkeys = efm1.getSortedCategoryEntries();
        Node[] keys = (Node[])lkeys.toArray(new Node[lkeys.size()]);
        int[] counts = new int[keys.length+1];
        for (int ii=0; ii<keys.length; ii++) {
          Integer cnt = (Integer) efm1.getEntryCount(keys[ii]);
          counts[ii] = cnt.intValue();
        }
        // add N
        counts[keys.length] = efm1.getTokenTotal();

        for (int ii = 0; ii < keys.length; ii++) {
          String nodepath = efm1.getEntryPath(keys[ii]);

          writer.write(",");
          writer.write(FileUtil.escapeForCsv(nodepath));
        }
        writer.write(",Total\n");
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.reporting.EntryFrequencyMap

        TokenList tl1 = tcache.getTokenList(doc);
        if (tl1 == null)
            tl1 = TokenizationService.getTokenizationService().tokenize(doc);
       
        // compute the dictionary counts
        EntryFrequencyMap efm1 = new EntryFrequencyMap(catnode, tl1);
   
        int[] counts = new int[keys.length+1];
    for (int ii=0; ii<keys.length; ii++) {
      Integer cnt = (Integer) efm1.getEntryCount(keys[ii]);
      counts[ii] = cnt.intValue();
    }
    // add N
    counts[keys.length] = efm1.getTokenTotal();
   
    return counts;
  }
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.reporting.EntryFrequencyMap

                if (tl1 == null)
                  tl1 = TokenizationService.getTokenizationService().tokenize(doc1);
                 YKDictionary dict = yoshikoder.getDictionary();
               
                 // compute the dictionary counts
                EntryFrequencyMap efm1 = new EntryFrequencyMap(catnode, tl1);
                List lkeys = efm1.getSortedCategoryEntries();
                Node[] keys = (Node[])lkeys.toArray(new Node[lkeys.size()]);
                int[] counts = new int[keys.length+1];
            for (int ii=0; ii<keys.length; ii++) {
              Integer cnt = (Integer) efm1.getEntryCount(keys[ii]);
              counts[ii] = cnt.intValue();
            }
            // add N
            counts[keys.length] = efm1.getTokenTotal();
             
            HSSFWorkbook wb = new HSSFWorkbook();
                HSSFRow row;
                HSSFCell cell;
               
                HSSFSheet sheet = wb.createSheet("Category frequencies");
               
                // header
                row = sheet.createRow((short)0);
                for (int c=0; c<keys.length; c++){
                  cell = row.createCell((short)(c+1));
                    cell.setEncoding(HSSFCell.ENCODING_UTF_16);
                    String nodepath = efm1.getEntryPath(keys[c]);
                    cell.setCellValue(nodepath);
                }
                cell = row.createCell((short)(keys.length+1));
                cell.setEncoding(HSSFCell.ENCODING_UTF_16);
                cell.setCellValue("Total");
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.reporting.EntryFrequencyMap

                if (tl1 == null)
                  tl1 = TokenizationService.getTokenizationService().tokenize(doc1);
                 YKDictionary dict = yoshikoder.getDictionary();
               
                 // compute the dictionary counts
                EntryFrequencyMap efm1 = new EntryFrequencyMap(catnode, tl1);
                List lkeys = efm1.getSortedCategoryEntries();
                Node[] keys = (Node[])lkeys.toArray(new Node[lkeys.size()]);
                int[] counts = new int[keys.length+1];
            for (int ii=0; ii<keys.length; ii++) {
              Integer cnt = (Integer) efm1.getEntryCount(keys[ii]);
              counts[ii] = cnt.intValue();
            }
            // add N
            counts[keys.length] = efm1.getTokenTotal();
             
            for (int ii = 0; ii < keys.length; ii++) {
          String nodepath = efm1.getEntryPath(keys[ii]);
         
          writer.write(",");
          writer.write(FileUtil.escapeForCsv(nodepath));
              }
            writer.write(",Total\n");
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.reporting.EntryFrequencyMap

        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!
           
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.reporting.EntryFrequencyMap

                        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,
View Full Code Here

Examples of edu.harvard.wcfia.yoshikoder.reporting.EntryFrequencyMap

                if (tl == null){
                    tl = TokenizationService.getTokenizationService().tokenize(doc);
                    tcache.putTokenList(doc, tl);
                }
               
                EntryFrequencyMap efm = new EntryFrequencyMap(catnode, tl);
               
                DictionaryFrequencyReport catsAndPats =
                    new DictionaryFrequencyReport("Dictionary Entry Frequencies",
                            "Frequencies of each dictionary entry in " + doc.getTitle(),
                            yoshikoder.getDictionary().getName(),
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.