A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

Untitled - Stikked
From Mammoth Ibis, 5 Years ago, written in Python.
Embed
  1. def CountVectorizer(texts, vocabulary):
  2.         """
  3.            Transform a collection of texts to a matrix of token counts
  4.            In order to be memory-efficient, the matrix of token counts
  5.            has a sparse representation of the counts using scipy.sparse.csr_matrix
  6.        """
  7.        
  8.         j_indices = [] #indices is array of column indices
  9.         indptr = [] # indptr points to row starts in indices and data
  10.         values = [] #values is array of corresponding nonzero values
  11.         indptr.append(0)
  12.         for text in texts:
  13.             token_counter = {}
  14.             for token in text:
  15.                 if token in vocabulary:
  16.                     if vocabulary[token] in token_counter:
  17.                         token_counter[vocabulary[token]] += 1
  18.                     else:
  19.                         token_counter[vocabulary[token]] = 1
  20.                    
  21.             j_indices.extend(token_counter.keys())
  22.            
  23.             values.extend(token_counter.values())
  24.             indptr.append(len(j_indices))
  25.        
  26.         X = scipy.sparse.csr_matrix((values, j_indices, indptr),
  27.                           shape=(len(indptr) - 1, len(vocabulary)),
  28.                           )
  29.    
  30.         return X