Exemplo n.º 1
0
 def wshingling(self, text, window_size=4):
     """
     :param text: Text to be split into shingles.
     :type text: str.
     :param window_size: the window size for splitting the shingles.
     :type: int.
     :returns: text split into shingles.
             """
     window_size = int(window_size)
     s = Ngram()
     ngrams = s.wordNgram(text, window_size)
     shingling = []
     for x in ngrams:
         if x not in shingling:
             shingling.append(x)
     return shingling
Exemplo n.º 2
0
 def wshingling(self, text, window_size=4):
     """
     :param text: Text to be split into shingles.
     :type text: str.
     :param window_size: the window size for splitting the shingles.
     :type: int.
     :returns: text split into shingles.
             """
     window_size = int(window_size)
     s = Ngram()
     ngrams = s.wordNgram(text, window_size)
     shingling = []
     for x in ngrams:
         if x not in shingling:
             shingling.append(x)
     return shingling