def get_hamlet_term_doc_matrix(): # type: () -> TermDocMatrix hamlet_docs = get_hamlet_docs() hamlet_term_doc_matrix = build_from_category_whitespace_delimited_text([ (get_hamlet_snippet_binary_category(text), text) for i, text in enumerate(hamlet_docs) ]) return hamlet_term_doc_matrix
def get_hamlet_term_doc_matrix(): # type: () -> TermDocMatrix hamlet_docs = get_hamlet_docs() hamlet_term_doc_matrix = build_from_category_whitespace_delimited_text( [(get_hamlet_snippet_binary_category(text), text) for i, text in enumerate(hamlet_docs)] ) return hamlet_term_doc_matrix
def test_single_category_term_doc_matrix_should_error(self): with self.assertRaisesRegex( expected_exception= CannotCreateATermDocMatrixWithASignleCategoryException, expected_regex= 'Documents must be labeled with more than one category. ' 'All documents were labeled with category: "a"'): single_category_tdm = build_from_category_whitespace_delimited_text( [['a', text] for category, text in get_test_categories_and_documents()])
def test_single_category_term_doc_matrix_should_error(self): with self.assertRaisesRegex( expected_exception=CannotCreateATermDocMatrixWithASignleCategoryException, expected_regex='Documents must be labeled with more than one category. ' 'All documents were labeled with category: "a"'): single_category_tdm = build_from_category_whitespace_delimited_text( [['a', text] for category, text in get_test_categories_and_documents()] )
def make_a_test_term_doc_matrix(): # type: () -> TermDocMatrix return build_from_category_whitespace_delimited_text( get_test_categories_and_documents())
def make_a_test_term_doc_matrix(): # type: () -> TermDocMatrix return build_from_category_whitespace_delimited_text( get_test_categories_and_documents() )