示例#1
0
        public bool TryGetTokenFrequency(Token token, out TokenVerseFrequency tokenFrequency)
        {
            if(map == null)
                map = BuildMap();

            return map.TryGetValue(token, out tokenFrequency);
        }
示例#2
0
 private static void AccumulateTokens(Dictionary<string, TokenVerseFrequency> m, IVerse verse, IEnumerable<Token> tokens)
 {
     foreach (var token in tokens)
     {
         TokenVerseFrequency tokenVerseFrequency;
         if (!m.TryGetValue(token.TokenString, out tokenVerseFrequency))
         {
             tokenVerseFrequency = new TokenVerseFrequency(token);
             m.Add(token, tokenVerseFrequency);
         }
         tokenVerseFrequency.Increment(verse);
     }
 }