public void Frequency(MyMapNode <int, string> hash)
 {
     for (int key = 0; key < hash.size; key++)
     {
         frequency.TryAdd(hash.Get(key).ToLower(), 0);
         frequency[hash.Get(key).ToLower()]++;
     }
     foreach (KeyValuePair <string, int> item in frequency)
     {
         Console.WriteLine($"frequency of word '{item.Key}' is {item.Value}");
     }
 }
示例#2
0
 public void Remove(MyMapNode <int, string> hash, string word)
 {
     for (int key = 0; key < hash.size; key++)
     {
         if (hash.Get(key).Equals(word))
         {
             hash.Remove(key);
             Console.WriteLine("Removed " + word + " from paragraph");
         }
     }
 }
示例#3
0
 public void DisplaySentence()
 {
     for (int keyNo = 0; keyNo < words.Length; keyNo++)
     {
         string wordInNewSentence = myMapNodeObj.Get(keyNo);
         if (wordInNewSentence != null)
         {
             Console.Write(wordInNewSentence + " ");
         }
         else
         {
             Console.Write("");
         }
     }
 }