public bool TryGetTokenFrequency(Token token, out TokenVerseFrequency tokenFrequency) { if(map == null) map = BuildMap(); return map.TryGetValue(token, out tokenFrequency); }
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); } }