Last active
August 16, 2017 14:34
-
-
Save nozma/20ea9d7e2a0335921bdce27b213f87aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # coding: utf-8 | |
| def n_gram(n, s): | |
| result = [] | |
| for i in range(0, len(s)-n+1): | |
| result.append(s[i:i+n]) | |
| return result | |
| print(n_gram(2, 'I am an NLPer')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment