Examples of Dictionary


Examples of java.util.Dictionary

   * @param bundle The bundle to update the cached log level for.
   */
  private void computeBidFilter(final Bundle bundle) {
    Integer level = (Integer) blFilters.get(bundle.getLocation());
    if (null == level) {
      final Dictionary d = bundle.getHeaders("");
      String l = (String) d.get("Bundle-SymbolicName");
      if (null == l) {
        l = (String) d.get("Bundle-Name");
      }
      if (null != l) {
        level = (Integer) blFilters.get(l);
      }
    }
View Full Code Here

Examples of java.util.Dictionary

    }

    public StringBuffer  bundleInfo(Bundle b) {
      StringBuffer sb = new StringBuffer();

      Dictionary headers = b.getHeaders();

      sb.append("<table border=0 cellspacing=1 cellpadding=0>\n");
      appendRow(sb, "Location", "" + b.getLocation());
      appendRow(sb, "State",    Util.stateName(b.getState()));
      if (b.getSymbolicName() != null) {
        appendRow(sb, "Symbolic name", b.getSymbolicName());
      }
      appendRow(sb, "Last modified", "" + new SimpleDateFormat().format(new Date(b.getLastModified())));

      StartLevel sls = (StartLevel)Activator.desktop.slTracker.getService();
      if(sls != null) {
        String level = "";
        try {
          level = Integer.toString(sls.getBundleStartLevel(b));
        } catch (IllegalArgumentException e) {
          level = "not managed";
        }
        appendRow(sb, "Start level", level);
      }

      // Spacer for better layout (and separation of non-manifest data):
      appendRow(sb, "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", "");

      List headerKeys = new ArrayList(headers.size());
      for(Enumeration e = headers.keys(); e.hasMoreElements(); ) {
        headerKeys.add(e.nextElement());
      }
      Collections.sort(headerKeys);
      for(Iterator it = headerKeys.iterator(); it.hasNext(); ) {
        String  key   = (String)it.next();
        String  value = (String)headers.get(key);
        if(value != null && !"".equals(value)) {
          value = Strings.replace(value, "<", "&lt;");
          value = Strings.replace(value, ">", "&gt;");
          if("Import-Package".equals(key) ||
             "Export-Service".equals(key) ||
View Full Code Here

Examples of jdsl.core.api.Dictionary

   * <code>edgeFile_</code>. Must be one of checkbox data set listeners.
   */
  private void loadDataset() {
    Parser.removeAllEdges(dataSet_);
    Parser.removeAllVertices(dataSet_);
    Dictionary d = null;
    try {
      if (docBase_ != null) {
  d = Parser.parseVertices(new URL(docBase_.toString() + vertexFile_), dataSet_);
      } else {
  d = Parser.parseVertices(vertexFile_, dataSet_);
View Full Code Here

Examples of morfologik.stemming.Dictionary

    method.setAccessible(true);
    return (String) method.invoke(null, argObjects);
  }

  public static void testDictionary(BaseTagger tagger, Language language) throws IOException {
    final Dictionary dictionary = Dictionary.read(JLanguageTool.getDataBroker().getFromResourceDirAsUrl(tagger.getFileName()));
    final DictionaryLookup lookup = new DictionaryLookup(dictionary);
    for (WordData wordData : lookup) {
      if (wordData.getTag() == null || wordData.getTag().length() == 0) {
        System.err.println("**** Warning: " + language + ": the word " + wordData.getWord() + "/" + wordData.getStem() + " lacks a POS tag in the dictionary.");
      }
View Full Code Here

Examples of morfologik.stemming.PolishStemmer.DICTIONARY

  public void init(Map<String,String> args) {
    super.init(args);
    String dictionaryName = args.get(DICTIONARY_SCHEMA_ATTRIBUTE);
    if (dictionaryName != null && !dictionaryName.isEmpty()) {
      try {
        DICTIONARY dictionary = DICTIONARY.valueOf(dictionaryName.toUpperCase(Locale.ROOT));
        assert dictionary != null;
        this.dictionary = dictionary;
      } catch (IllegalArgumentException e) {
        throw new IllegalArgumentException("The " + DICTIONARY_SCHEMA_ATTRIBUTE + " attribute accepts the "
            + "following constants: " + Arrays.toString(DICTIONARY.values()) + ", this value is invalid: " 
View Full Code Here

Examples of net.paoding.analysis.dictionary.Dictionary

  public synchronized Dictionary getVocabularyDictionary() {
    if (vocabularyDictionary == null) {
      // 大概有5639个字有词语,故取0x2fff=x^13>8000>8000*0.75=6000>5639
      vocabularyDictionary = new HashBinaryDictionary(
          getVocabularyWords(), 0x2fff, 0.75f);
      Dictionary noiseWordsDic = getNoiseWordsDictionary();
      for (int i = 0; i < noiseWordsDic.size(); i++) {
        Hit hit = vocabularyDictionary.search(noiseWordsDic.get(i), 0, noiseWordsDic.get(i).length());
        if (hit.isHit()) {
          hit.getWord().setNoiseWord();
        }
      }
      Dictionary noiseCharactorsDic = getNoiseCharactorsDictionary();
      for (int i = 0; i < noiseCharactorsDic.size(); i++) {
        Hit hit = vocabularyDictionary.search(noiseCharactorsDic.get(i), 0, noiseCharactorsDic.get(i).length());
        if (hit.isHit()) {
          hit.getWord().setNoiseCharactor();
        }
      }
     
View Full Code Here

Examples of opennlp.tools.coref.mention.Dictionary

    }

  private static Set<String> getSynsetSet(Context c) {
    Set<String> synsetSet = new HashSet<String>();
    String[] lemmas = getLemmas(c);
    Dictionary dict = DictionaryFactory.getDictionary();
    //System.err.println(lemmas.length+" lemmas for "+c.headToken);
    for (int li = 0; li < lemmas.length; li++) {
      String senseKey = dict.getSenseKey(lemmas[li],"NN",0);
      if (senseKey != null) {
        synsetSet.add(senseKey);
        String[] synsets = dict.getParentSenseKeys(lemmas[li],"NN",0);
        for (int si=0,sn=synsets.length;si<sn;si++) {
          synsetSet.add(synsets[si]);
        }
      }
    }
View Full Code Here

Examples of opennlp.tools.dictionary.Dictionary

        Map<String, Dictionary> dictionaries = new HashMap<String, Dictionary>();
        Iterable<DictionaryEntry> entries = dictionaryEntryRepository.findAll(getUser().getModelUserContext());
        for (DictionaryEntry entry : entries) {

            if (!dictionaries.containsKey(entry.getMetadata().getConcept())) {
                dictionaries.put(entry.getMetadata().getConcept(), new Dictionary());
            }

            dictionaries.get(entry.getMetadata().getConcept()).put(tokensToStringList(entry.getMetadata().getTokens()));
        }
View Full Code Here

Examples of opennlp.tools.ngram.Dictionary

    events = ec.getEvents();
    //System.err.println("POSEventStream.addNewEvents: got "+events.length+" events");
  }

  public static void main(String[] args) throws java.io.IOException {
    EventStream es = new POSEventStream(new opennlp.maxent.PlainTextByLineDataStream(new java.io.InputStreamReader(System.in)),new Dictionary(args[0]));
    while (es.hasNext()) {
      System.out.println(es.nextEvent());
    }
  }
View Full Code Here

Examples of org.apache.ctakes.dictionary.lookup.Dictionary

      }

      final Element lookupFieldEl = rootDictEl.getChild( "lookupField" );
      final String lookupFieldName = lookupFieldEl.getAttributeValue( "fieldName" );

      Dictionary dict;
      try {
         if (rootDictEl.getChild( "implementation" ).getChildren().isEmpty() ) {
            throw new ResourceAccessException( new IndexOutOfBoundsException() );
         }
         final Element implEl = (Element) rootDictEl.getChild( "implementation" ).getChildren().get( 0 );
         final String implType = implEl.getName();
         if ( implType.equals( "luceneImpl" ) ) {
            if ( !(extResrc instanceof LuceneIndexReaderResource) ) {
               throw new ResourceAccessException( "Expected external resource to be:"
                                          + LuceneIndexReaderResource.class, new Object[]{extResrc} );
            }
            final IndexReader indexReader = ((LuceneIndexReaderResource) extResrc).getIndexReader();
            final IndexSearcher indexSearcher = new IndexSearcher( indexReader );
            // Added 'MaxListSize' ohnlp-Bugs-3296301
            dict = new LuceneDictionaryImpl( indexSearcher, lookupFieldName, MAX_LIST_SIZE );
         } else if ( implType.equals( "jdbcImpl" ) ) {
            final String tableName = implEl.getAttributeValue( "tableName" );
            if ( !(extResrc instanceof JdbcConnectionResource) ) {
               throw new ResourceAccessException( "Expected external resource to be:"
                                          + JdbcConnectionResource.class, new Object[]{extResrc} );
            }
            final Connection conn = ((JdbcConnectionResource) extResrc).getConnection();
            dict = new JdbcDictionaryImpl( conn, tableName, lookupFieldName );
         } else if ( implType.equals( "csvImpl" ) ) {
            final String fieldDelimiter = implEl.getAttributeValue( "delimiter" );
            if ( !(extResrc instanceof FileResource) ) {
               throw new ResourceAccessException( "Expected external resource to be:"
                                          + FileResource.class, new Object[]{extResrc} );
            }

            final String idxFieldNameStr = implEl.getAttributeValue( "indexedFieldNames" );
            final StringTokenizer st = new StringTokenizer( idxFieldNameStr, "," );
            int arrIdx = 0;
            String[] idxFieldNameArr = new String[st.countTokens()];
            while ( st.hasMoreTokens() ) {
               idxFieldNameArr[arrIdx++] = st.nextToken().trim();
            }

            final File csvFile = ((FileResource) extResrc).getFile();
            try {
               final StringTable strTable = StringTableFactory.build( new FileReader( csvFile ),
                     fieldDelimiter, idxFieldNameArr, true );
               dict = new StringTableDictionaryImpl( strTable, lookupFieldName );
            } catch ( FileNotFoundException fnfE ) {
               throw new ResourceAccessException( "Could not open csv file", new Object[]{csvFile} );
            } catch (IOException ioE ) {
               throw new ResourceAccessException( "Could not open csv file", new Object[]{csvFile} );
            }
         } else {
            throw new ResourceAccessException( "Unsupported impl type:" + implType, new Object[]{implType} );
         }

         final List<Element> rootDictChildren = rootDictEl.getChild( "metaFields" ).getChildren();
         for ( Element metaFieldEl : rootDictChildren ) {
            final String metaFieldName = metaFieldEl.getAttributeValue( "fieldName" );
            dict.retainMetaData( metaFieldName );
         }
      } catch ( NullPointerException npE ) {
         // thrown all over this method ...
         throw new ResourceAccessException( npE );
      }
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.