Refactored and created a method of CourseUnit class to generate ngrams