ngrams n (x:xs) = if length xs >= (n - 1)
                   then [take n (x:xs)] ++ ngrams n xs
                   else []
ngrams n (x:xs) = if length xs >= (n - 1)
                   then [take n (x:xs)] ++ ngrams n xs
                   else []
ngrams n (x:xs) = if length xs >= (n - 1)
                   then [take n (x:xs)] ++ ngrams n xs
                   else []