This file contains 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
#!/usr/bin/env python3 | |
# -*- coding:utf-8 -*-] | |
sample_text = "신은 다시 일어서는 법을 가르치기 위해 넘어뜨린다고 나는 믿는다." | |
def word_ngram(sentence, num_gram): | |
ngrams = [] | |
text = list(sentence) # split the sentence into an array of characters | |
ngrams = [text[x:x+num_gram] for x in range(0, len(text))] |