Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. List<string[]> threeGrams = new List<string[]>();
  2. int wordCount = nonEmptyWords.Count;
  3. for (int i = 0; i < wordCount - 2; i++)
  4. {
  5. string[] threeGram = new string[3];
  6. for (int j = 0; j < 3; j++)
  7. {
  8. threeGram[j] = nonEmptyWords[i + j];
  9. }
  10.  
  11. threeGrams.Add(threeGram);
  12. }
  13.  
  14. threeGrams.Add(new[] { nonEmptyWords[wordCount - 2], nonEmptyWords[wordCount - 1]});
  15. threeGrams.Add(new[] { nonEmptyWords[wordCount - 1] });
  16.  
  17. foreach (string[] threeGram in threeGrams)
  18. {
  19. output.Set("MeetingId", meetingId);
  20.  
  21. output.Set("SubjectThreeGramWord1", threeGram[0]);
  22.  
  23. if (threeGram.Length >= 2)
  24. {
  25. output.Set("SubjectThreeGramWord2", threeGram[1]);
  26. }
  27. else
  28. {
  29. output.Set<string>("SubjectThreeGramWord2", null);
  30. }
  31.  
  32. if (threeGram.Length >= 3)
  33. {
  34. output.Set<string>("SubjectThreeGramWord3", threeGram[2]);
  35. }
  36. else
  37. {
  38. output.Set<string>("SubjectThreeGramWord3", null);
  39. }
  40.  
  41. yield return output.AsReadOnly();
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement