创建一个地名实例

@param realWord
@param frequency
@return
15602
public static Vertex newPlaceInstance(String realWord, int frequency)
    {
        return new Vertex(Predefine.TAG_PLACE, realWord, new CoreDictionary.Attribute(Nature.ns, frequency));
    }
447540
public int getDocFreq(int term) {
		int[] docfreq = (int[]) this.index2docfreq.get(Integer.valueOf(term));
		if (docfreq == null)
			return 0;
		return docfreq[0];
	}
202990
def get_term_freq(self, go_id):
        '''
            
        '''
        num_ns = float(self.get_total_count(self.go2obj[go_id].namespace))
        return float(self.get_count(go_id))/num_ns if num_ns != 0 else 0
170532
private Instance getExistingLocale(final long _propertyid,
                                       final String _language)
    {
        Instance ret = null;
        try {
            final QueryBuilder queryBldr = new QueryBuilder(Type.get(DBPropertiesUpdate.TYPE_PROPERTIES_LOCAL));
            queryBldr.addWhereAttrEqValue("PropertyID", _propertyid);
            queryBldr.addWhereAttrEqValue("LanguageID", getLanguageId(_language));
            final InstanceQuery query = queryBldr.getQuery();
            query.executeWithoutAccessCheck();
            if (query.next()) {
                ret = query.getCurrentValue();
            }
        } catch (final EFapsException e) {
            DBPropertiesUpdate.LOG.error("getExistingLocale(String)", e);
        }
        return ret;
    }
1149752
public LanguageProfileBuilder addGram(String ngram, int frequency) {
        Map<String, Integer> map = ngrams.get(ngram.length());
        if (map==null) {
            map = new HashMap<>();
            ngrams.put(ngram.length(), map);
        }
        Integer total = map.get(ngram);
        if (total==null) total = 0;
        total += frequency;
        map.put(ngram, total);
        return this;
    }
1304013
private void addTermFrequencies(Reader r, Map<String, Int> termFreqMap, String fieldName) throws IOException
   {
      TokenStream ts = analyzer.tokenStream(fieldName, r);
      int tokenCount = 0;
      // for every token
      while (ts.incrementToken())
      {
         CharTermAttribute term = ts.getAttribute(CharTermAttribute.class);
         String word = new String(term.buffer(), 0, term.length());
         tokenCount++;
         if (tokenCount > maxNumTokensParsed)
         {
            break;
         }
         if (isNoiseWord(word))
         {
            continue;
         }

         // increment frequency
         Int cnt = termFreqMap.get(word);
         if (cnt == null)
         {
            termFreqMap.put(word, new Int());
         }
         else
         {
            cnt.x++;
         }
      }
      ts.end();
      ts.close();
   }
577519
public int getFrequency(final CharSequence word) {
    if (!dictionaryMetadata.isFrequencyIncluded()) {
      return 0;
    }

    final byte separator = dictionaryMetadata.getSeparator();
    try {
      byteBuffer = charSequenceToBytes(word);
    } catch (UnmappableInputException e) {
      return 0;
    }

    final MatchResult match = matcher.match(matchResult, byteBuffer.array(), 0, byteBuffer.remaining(), rootNode);
    if (match.kind == SEQUENCE_IS_A_PREFIX) {
      final int arc = fsa.getArc(match.node, separator);
      if (arc != 0 && !fsa.isArcFinal(arc)) {
        finalStatesIterator.restartFrom(fsa.getEndNode(arc));
        if (finalStatesIterator.hasNext()) {
          final ByteBuffer bb = finalStatesIterator.next();
          final byte[] ba = bb.array();
          final int bbSize = bb.remaining();
          //the last byte contains the frequency after a separator
          return ba[bbSize - 1] - FIRST_RANGE_CODE;
        }
      }
    }
    return 0;
  }
423449
public static String getBasename0(final String pFileName) {
        int index = pFileName.lastIndexOf('.');

        if (index >= 0) {
            return pFileName.substring(0, index);
        }

        // No period found
        return pFileName;
    }
1139067
def frequency=(frequency)
      validator = EnumAttributeValidator.new('String', ['never', 'daily', 'weekly', 'everyOtherWeek', 'twiceAMonth', 'every4Weeks', 'monthly', 'everyOtherMonth', 'every3Months', 'every4Months', 'twiceAYear', 'yearly', 'everyOtherYear'])
      unless validator.valid?(frequency)
        fail ArgumentError, 'invalid value for "frequency", must be one of #{validator.allowable_values}.'
      end
      @frequency = frequency
    end
1054956
protected void setRealName(Graph graph, List<Term> result) {

        if (!MyStaticValue.isRealName) {
            return;
        }

        String str = graph.realStr;

        for (Term term : result) {
            term.setRealName(str.substring(term.getOffe(), term.getOffe() + term.getName().length()));
        }
    }
1119879
public static int getTwoWordFreq(Term from, Term to) {
        if (from.item().bigramEntryMap == null) {
            return 0;
        }
        Integer freq = from.item().bigramEntryMap.get(to.item().getIndex());
        if (freq == null) {
            return 0;
        } else {
            return freq;
        }
    }
12758
public boolean isReallocationRequired()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
    {
      SibTr.entry(this, tc, "isReallocationRequired");
      SibTr.exit(tc, "isReallocationRequired", Boolean.valueOf(reallocateOnCommit));
    }

    return reallocateOnCommit;
  }
1076920
def set_frequency(self, host, sem=None, interval=None):
        """"""
        # single sem or global sem
        sem = sem or self.sem
        interval = self.interval if interval is None else interval
        frequency = Frequency(sem, interval, host)
        frequencies = {host: frequency}
        self.update_frequency(frequencies)
        return frequency
25805
static Glossary createGlossary(String projectId, String location, String name, String gcsUri) {
    try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {

      LocationName locationName =
          LocationName.newBuilder().setProject(projectId).setLocation(location).build();
      LanguageCodesSet languageCodesSet =
          LanguageCodesSet.newBuilder().addLanguageCodes("en").addLanguageCodes("es").build();
      GcsSource gcsSource = GcsSource.newBuilder().setInputUri(gcsUri).build();
      GlossaryInputConfig glossaryInputConfig =
          GlossaryInputConfig.newBuilder().setGcsSource(gcsSource).build();
      GlossaryName glossaryName =
          GlossaryName.newBuilder()
              .setProject(projectId)
              .setLocation(location)
              .setGlossary(name)
              .build();
      Glossary glossary =
          Glossary.newBuilder()
              .setLanguageCodesSet(languageCodesSet)
              .setInputConfig(glossaryInputConfig)
              .setName(glossaryName.toString())
              .build();
      CreateGlossaryRequest request =
          CreateGlossaryRequest.newBuilder()
              .setParent(locationName.toString())
              .setGlossary(glossary)
              .build();

      // Call the API
      Glossary response =
          translationServiceClient.createGlossaryAsync(request).get(300, TimeUnit.SECONDS);
      System.out.format("Created: %s\n", response.getName());
      System.out.format("Input Uri: %s\n", response.getInputConfig().getGcsSource());
      return response;

    } catch (Exception e) {
      throw new RuntimeException("Couldn't create client.", e);
    }
  }
817341
def ensure_frequencies(self, frequencies):
        """"""
        if not frequencies:
            return {}
        if not isinstance(frequencies, dict):
            raise ValueError("frequencies should be dict")
        frequencies = {
            host: Frequency.ensure_frequency(frequencies[host]) for host in frequencies
        }
        return frequencies
83482
public static Phrase from(Fragment f, @StringRes int patternResourceId) {
    return from(f.getResources(), patternResourceId);
  }
1358829
private String compileRealWord(String realWord, CoreDictionary.Attribute attribute)
    {
        if (attribute.nature.length == 1)
        {
            Nature nature = attribute.nature[0];
            if (nature.startsWith("nr"))
            {
                wordID = CoreDictionary.NR_WORD_ID;
//                    this.attribute = CoreDictionary.get(CoreDictionary.NR_WORD_ID);
                return Predefine.TAG_PEOPLE;
            }
            else if (nature.startsWith("ns"))
            {
                wordID = CoreDictionary.NS_WORD_ID;
                // 在地名识别的时候,希望类似"河镇"的词语保持自己的词性,而不是未##地的词性
//                    this.attribute = CoreDictionary.get(CoreDictionary.NS_WORD_ID);
                return Predefine.TAG_PLACE;
            }
//                case nz:
            else if (nature == Nature.nx)
            {
                wordID = CoreDictionary.NX_WORD_ID;
                if (wordID == -1)
                    wordID = CoreDictionary.X_WORD_ID;
//                    this.attribute = CoreDictionary.get(wordID);
                return Predefine.TAG_PROPER;
            }
            else if (nature.startsWith("nt") || nature == Nature.nit)
            {
                wordID = CoreDictionary.NT_WORD_ID;
//                    this.attribute = CoreDictionary.get(CoreDictionary.NT_WORD_ID);
                return Predefine.TAG_GROUP;
            }
            else if (nature.startsWith('m'))
            {
                wordID = CoreDictionary.M_WORD_ID;
                this.attribute = CoreDictionary.get(CoreDictionary.M_WORD_ID);
                return Predefine.TAG_NUMBER;
            }
            else if (nature.startsWith('x'))
            {
                wordID = CoreDictionary.X_WORD_ID;
                this.attribute = CoreDictionary.get(CoreDictionary.X_WORD_ID);
                return Predefine.TAG_CLUSTER;
            }
//                case xx:
//                case w:
//                {
//                    word= Predefine.TAG_OTHER;
//                }
//                break;
            else if (nature == Nature.t)
            {
                wordID = CoreDictionary.T_WORD_ID;
                this.attribute = CoreDictionary.get(CoreDictionary.T_WORD_ID);
                return Predefine.TAG_TIME;
            }
        }

        return realWord;
    }