def _create_matrix(self, document, dictionary):
    '\n        Creates matrix of shape |unique words|×|sentences| where cells\n        contains number of occurences of words (rows) in senteces (cols).\n        '
    sentences = document.sentences
    words_count = len(dictionary)
    sentences_count = len(sentences)
    if (words_count < sentences_count):
        message = 'Number of words (%d) is lower than number of sentences (%d). LSA algorithm may not work properly.'
        warn((message % (words_count, sentences_count)))
    matrix = numpy.zeros((words_count, sentences_count))
    for (col, sentence) in enumerate(sentences):
        for word in map(self.stem_word, sentence.words):
            if (word in dictionary):
                row = dictionary[word]
                matrix[(row, col)] += 1
    return matrix
Creates matrix of shape |unique words|×|sentences| where cells
contains number of occurences of words (rows) in senteces (cols).
def _create_matrix(self, document, dictionary):
    '\n        Creates matrix of shape |unique words|×|sentences| where cells\n        contains number of occurences of words (rows) in senteces (cols).\n        '
    sentences = document.sentences
    words_count = len(dictionary)
    sentences_count = len(sentences)
    if (words_count < sentences_count):
        message = 'Number of words (%d) is lower than number of sentences (%d). LSA algorithm may not work properly.'
        warn((message % (words_count, sentences_count)))
    matrix = numpy.zeros((words_count, sentences_count))
    for (col, sentence) in enumerate(sentences):
        for word in map(self.stem_word, sentence.words):
            if (word in dictionary):
                row = dictionary[word]
                matrix[(row, col)] += 1
    return matrix