parameters: (self, X, vocabulary)
return_statement: return X
docstring: Sort features by name
  
          Returns a reordered matrix and modifies the vocabulary in place
docstring_summary: Sort features by name
docstring_tokens: Sort features by name
function: def _sort_features(self, X, vocabulary):
          """Sort features by name
  
          Returns a reordered matrix and modifies the vocabulary in place
          """
          sorted_features = sorted(vocabulary.items())
          map_index = np.empty(len(sorted_features), dtype=X.indices.dtype)
          for new_val, (term, old_val) in enumerate(sorted_features):
              vocabulary[term] = new_val
              map_index[old_val] = new_val
  
          X.indices = map_index.take(X.indices, mode='clip')
          return X
function_tokens: def _sort_features ( self , X , vocabulary ) : sorted_features = sorted ( vocabulary . items ( ) ) map_index = np . empty ( len ( sorted_features ) , dtype = X . indices . dtype ) for new_val , ( term , old_val ) in enumerate ( sorted_features ) : vocabulary [ term ] = new_val map_index [ old_val ] = new_val X . indices = map_index . take ( X . indices , mode = 'clip' ) return X