Examples of Dictionary


Examples of org.apache.hadoop.hbase.io.util.Dictionary

  @Test
  public void testCompressingWithClearDictionaries() throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DataOutputStream dos = new DataOutputStream(baos);
    Dictionary dictionary = new LRUDictionary();
    dictionary.init(Short.MAX_VALUE);
    byte [] blahBytes = Bytes.toBytes("blah");
    Compressor.writeCompressed(blahBytes, 0, blahBytes.length, dos, dictionary);
    dos.close();
    byte [] dosbytes = baos.toByteArray();
    DataInputStream dis =
      new DataInputStream(new ByteArrayInputStream(dosbytes));
    dictionary = new LRUDictionary();
    dictionary.init(Short.MAX_VALUE);
    byte [] product = Compressor.readCompressed(dis, dictionary);
    assertTrue(Bytes.equals(blahBytes, product));
  }
View Full Code Here

Examples of org.apache.lucene.analysis.hunspell.Dictionary

        ZipEntry affEntry = zip.getEntry(tests[i+2]);
        assert affEntry != null;
     
        try (InputStream dictionary = zip.getInputStream(dicEntry);
             InputStream affix = zip.getInputStream(affEntry)) {
          Dictionary dic = new Dictionary(affix, dictionary);
          System.out.println(tests[i] + "\t" + RamUsageTester.humanSizeOf(dic) + "\t(" +
                             "words=" + RamUsageTester.humanSizeOf(dic.words) + ", " +
                             "flags=" + RamUsageTester.humanSizeOf(dic.flagLookup) + ", " +
                             "strips=" + RamUsageTester.humanSizeOf(dic.stripData) + ", " +
                             "conditions=" + RamUsageTester.humanSizeOf(dic.patterns) + ", " +
View Full Code Here

Examples of org.apache.lucene.analysis.ja.dict.Dictionary

          attrs = " color=\"#40e050\" fontcolor=\"#40a050\" penwidth=3 fontsize=20";
        } else {
          attrs = "";
        }

        final Dictionary dict = tok.getDict(posData.backType[idx]);
        final int wordCost = dict.getWordCost(posData.backID[idx]);
        final int bgCost = costs.get(backPosData.lastRightID[posData.backIndex[idx]],
                                     dict.getLeftId(posData.backID[idx]));

        final String surfaceForm = new String(fragment,
                                              posData.backPos[idx] - startPos,
                                              pos - posData.backPos[idx]);
       
View Full Code Here

Examples of org.apache.lucene.search.spell.Dictionary

        indexReader = IndexReader.open(indexDir);
        // 1. Create content spellIndex
        File spellDictionaryFile = new File(spellDictionaryPath);
        Directory contentSpellIndexDirectory = FSDirectory.open(new File(spellDictionaryPath + CONTENT_PATH));//true
        SpellChecker contentSpellChecker = new SpellChecker(contentSpellIndexDirectory);
        Dictionary contentDictionary = new LuceneDictionary(indexReader, OlatDocument.CONTENT_FIELD_NAME);
        contentSpellChecker.indexDictionary(contentDictionary);
        // 2. Create title spellIndex
        Directory titleSpellIndexDirectory = FSDirectory.open(new File(spellDictionaryPath + TITLE_PATH));//true
        SpellChecker titleSpellChecker = new SpellChecker(titleSpellIndexDirectory);
        Dictionary titleDictionary = new LuceneDictionary(indexReader, OlatDocument.TITLE_FIELD_NAME);
        titleSpellChecker.indexDictionary(titleDictionary);
        // 3. Create description spellIndex
        Directory descriptionSpellIndexDirectory = FSDirectory.open(new File(spellDictionaryPath + DESCRIPTION_PATH));//true
        SpellChecker descriptionSpellChecker = new SpellChecker(descriptionSpellIndexDirectory);
        Dictionary descriptionDictionary = new LuceneDictionary(indexReader, OlatDocument.DESCRIPTION_FIELD_NAME);
        descriptionSpellChecker.indexDictionary(descriptionDictionary);
        // 4. Create author spellIndex
        Directory authorSpellIndexDirectory = FSDirectory.open(new File(spellDictionaryPath + AUTHOR_PATH));//true
        SpellChecker authorSpellChecker = new SpellChecker(authorSpellIndexDirectory);
        Dictionary authorDictionary = new LuceneDictionary(indexReader, OlatDocument.AUTHOR_FIELD_NAME);
        authorSpellChecker.indexDictionary(authorDictionary);
       
        // Merge all part spell indexes (content,title etc.) to one common spell index
        Directory spellIndexDirectory = FSDirectory.open(spellDictionaryFile);//true
        IndexWriter merger = new IndexWriter(spellIndexDirectory, new StandardAnalyzer(Version.LUCENE_CURRENT), true, IndexWriter.MaxFieldLength.UNLIMITED);
View Full Code Here

Examples of org.apache.mahout.vectorizer.encoders.Dictionary

    encoder.setTraceDictionary(traceDictionary);
    FeatureVectorEncoder bias = new ConstantValueEncoder("Intercept");
    bias.setTraceDictionary(traceDictionary);
    FeatureVectorEncoder lines = new ConstantValueEncoder("Lines");
    lines.setTraceDictionary(traceDictionary);
    Dictionary newsGroups = new Dictionary();
   
    OnlineLogisticRegression learningAlgorithm =
        new OnlineLogisticRegression(
              20, FEATURES, new L1())
            .alpha(1).stepOffset(1000)
            .decayExponent(0.9)
            .lambda(3.0e-5)
            .learningRate(20);
   
    List<File> files = new ArrayList<File>();
    for (File newsgroup : base.listFiles()) {
      newsGroups.intern(newsgroup.getName());
      files.addAll(Arrays.asList(newsgroup.listFiles()));
    }

    Collections.shuffle(files);
    System.out.printf("%d training files\n", files.size());
View Full Code Here

Examples of org.apache.uima.annotator.dict_annot.dictionary.Dictionary

                  "initialize", MESSAGE_DIGEST,
                  "dictionary_annotator_dictionary_file", new Object[] { file
                        .getFilePath() });

            // parse dictionary file
            Dictionary dict = fileParser.parseDictionaryFile(
                  file.getFilePath(), file.getStream(), new HashMapDictionaryBuilder());
            // add dictionary to the dictionary list
            dicts.add(dict);
         }
      }
View Full Code Here

Examples of org.cfeclipse.cfmledit.dictionary.Dictionary

  }
 
  @Test
  public void TestIsSingleton() {
    try{
      Dictionary dic1 = Dictionary.getInstance();
      Dictionary dic2 = Dictionary.getInstance();
      assertEquals(dic1, dic2);
    }
    catch(Exception e){
      e.printStackTrace();
    }
View Full Code Here

Examples of org.cipango.diameter.Dictionary

    int flags = i >> 24 & 0xff;
    boolean isRequest = ((flags & REQUEST_FLAG) == REQUEST_FLAG);
   
    int code = i & 0xffffff;
   
    Dictionary dictionary = Dictionary.getInstance();
   
    DiameterCommand command = isRequest ? dictionary.getRequest(code) : dictionary.getAnswer(code);
    if (command == null)
      command = isRequest ? Factory.newRequest(code, "Unknown") : Factory.newAnswer(code, "Unknown");
   
    DiameterMessage message = isRequest ? new DiameterRequest() : new DiameterAnswer();
   
View Full Code Here

Examples of org.dayatang.persistence.test.domain.Dictionary

        return category;
    }

    private Dictionary createDictionary(String code, String text, DictionaryCategory category, int sortOrder,
            String parentCode) {
        Dictionary dictionary = new Dictionary(code, text, category);
        dictionary.setSortOrder(sortOrder);
        dictionary.setParentCode(parentCode);
        repository.save(dictionary);
        repository.flush();
        return dictionary;
    }
View Full Code Here

Examples of org.dayatang.utils.support.Dictionary

    public void test() {
        DictionaryCategory category = new DictionaryCategory();
        category.setName("a category");
        category.setSortOrder(1);
        category.setId(3L);
        Dictionary dictionary1 = new Dictionary("01", "男", category);
        Dictionary dictionary2 = new Dictionary("01", "男", category);
        category.setDictionaries(Sets.newHashSet(dictionary1, dictionary2));
        System.out.println(instance.serialize(category));
    }
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.