parameters: (self, texts)
docstring: Updates internal vocabulary based on a list of texts.
  
          In the case where texts contains lists,
          we assume each entry of the lists to be a token.
  
          Required before using `texts_to_sequences` or `texts_to_matrix`.
  
          # Arguments
              texts: can be a list of strings,
                  a generator of strings (for memory-efficiency),
                  or a list of list of strings.
docstring_summary: Updates internal vocabulary based on a list of texts.
docstring_tokens: Updates internal vocabulary based on a list of texts .
function: def fit_on_texts(self, texts):
          """Updates internal vocabulary based on a list of texts.
  
          In the case where texts contains lists,
          we assume each entry of the lists to be a token.
  
          Required before using `texts_to_sequences` or `texts_to_matrix`.
  
          # Arguments
              texts: can be a list of strings,
                  a generator of strings (for memory-efficiency),
                  or a list of list of strings.
          """
          for text in texts:
              self.document_count += 1
              if self.char_level or isinstance(text, list):
                  seq = text
              else:
                  seq = text_to_word_sequence(text,
                                              self.filters,
                                              self.lower,
                                              self.split)
              for w in seq:
                  if w in self.word_counts:
                      self.word_counts[w] += 1
                  else:
                      self.word_counts[w] = 1
              for w in set(seq):
                  if w in self.word_docs:
                      self.word_docs[w] += 1
                  else:
                      self.word_docs[w] = 1
  
          wcounts = list(self.word_counts.items())
          wcounts.sort(key=lambda x: x[1], reverse=True)
          sorted_voc = [wc[0] for wc in wcounts]
          # note that index 0 is reserved, never assigned to an existing word
          self.word_index = dict(
              list(zip(sorted_voc, list(range(1, len(sorted_voc) + 1)))))
  
          if self.oov_token is not None:
              i = self.word_index.get(self.oov_token)
              if i is None:
                  self.word_index[self.oov_token] = len(self.word_index) + 1
  
          for w, c in list(self.word_docs.items()):
              self.index_docs[self.word_index[w]] = c
function_tokens: def fit_on_texts ( self , texts ) : for text in texts : self . document_count += 1 if self . char_level or isinstance ( text , list ) : seq = text else : seq = text_to_word_sequence ( text , self . filters , self . lower , self . split ) for w in seq : if w in self . word_counts : self . word_counts [ w ] += 1 else : self . word_counts [ w ] = 1 for w in set ( seq ) : if w in self . word_docs : self . word_docs [ w ] += 1 else : self . word_docs [ w ] = 1 wcounts = list ( self . word_counts . items ( ) ) wcounts . sort ( key = lambda x : x [ 1 ] , reverse = True ) sorted_voc = [ wc [ 0 ] for wc in wcounts ] # note that index 0 is reserved, never assigned to an existing word self . word_index = dict ( list ( zip ( sorted_voc , list ( range ( 1 , len ( sorted_voc ) + 1 ) ) ) ) ) if self . oov_token is not None : i = self . word_index . get ( self . oov_token ) if i is None : self . word_index [ self . oov_token ] = len ( self . word_index ) + 1 for w , c in list ( self . word_docs . items ( ) ) : self . index_docs [ self . word_index [ w ] ] = c