Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public IDictionary<string, Index> CountWords(FullText fullText)
- {
- var wordCount = new Dictionary<string, Index>();
- foreach (Sentence sentence in fullText.text)
- {
- foreach (Word word in sentence.Words)
- {
- if(wordcount.ContainsKey(word.Value)) {
- wordcount[word.Value].WordCount++;
- wordcount[word.Value].NumbersOfSentence++;
- } else {
- wordcount[word.Value] = new Index {
- WordCout = 1,
- NumbersOfSentence = 1,
- firstLetterOfWord = word.Value[0]
- }
- }
- }
- }
- return wordCount;
- }
- public class Index
- {
- public int WordCount { get; set; }
- public int [] NumbersOfSentence { get; set; }
- public char firstLetterOfWord { get; set; }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement