<commit_before># -*- coding: utf-8 -*-
import os
import pickle
import re
import textwrap
from os import makedirs
from os.path import join as pathjoin
from typing import List, Tuple, Dict

import numpy as np
from flask import request

import lexos.helpers.constants as constants
import lexos.helpers.general_functions as general_functions
import lexos.managers.session_manager as session_manager
import lexos.processors.analyze.KMeans as KMeans
import lexos.processors.analyze.information as information
import lexos.processors.analyze.similarity as similarity
import lexos.processors.visualize.multicloud_topic as multicloud_topic
import lexos.processors.visualize.rw_analyzer as rw_analyzer
from lexos.helpers.general_functions import matrix_to_dict
from lexos.managers.file_manager import FileManager
from lexos.managers.session_manager import session_folder
from lexos.processors.analyze import dendrogrammer
from lexos.processors.analyze.topword import test_all_to_para, group_division, \
    test_para_to_group, test_group_to_group


def generate_csv_matrix(file_manager: FileManager, round_decimal: bool=False) \
        -> List[list]:
    """
    Gets a matrix properly formatted for output to a CSV file and also a table
    displaying on the Tokenizer page, with labels along the top and side
    for the words and files. Generates matrices by calling getMatrix()<commit_msg>fix style error<commit_after># -*- coding: utf-8 -*-
import os
import pickle
import re
import textwrap
from os import makedirs
from os.path import join as pathjoin
from typing import List, Tuple, Dict

import numpy as np
from flask import request

import lexos.helpers.constants as constants
import lexos.helpers.general_functions as general_functions
import lexos.managers.session_manager as session_manager
import lexos.processors.analyze.KMeans as KMeans
import lexos.processors.analyze.information as information
import lexos.processors.analyze.similarity as similarity
import lexos.processors.visualize.multicloud_topic as multicloud_topic
import lexos.processors.visualize.rw_analyzer as rw_analyzer
from lexos.helpers.general_functions import matrix_to_dict
from lexos.managers.file_manager import FileManager
from lexos.managers.session_manager import session_folder
from lexos.processors.analyze import dendrogrammer
from lexos.processors.analyze.topword import test_all_to_para, \
    group_division, test_para_to_group, test_group_to_group


def generate_csv_matrix(file_manager: FileManager, round_decimal: bool=False) \
        -> List[list]:
    """
    Gets a matrix properly formatted for output to a CSV file and also a table
    displaying on the Tokenizer page, with labels along the top and side
    for the words and files. Generates matrices by calling getMatrix()
{'fraction_non_alphanumeric': 0.05054151624548736, 'fraction_numerical': 0.0007220216606498195, 'mean_word_length': 5.489461358313817, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2818417', 'n_tokens_mistral': 827, 'n_tokens_neox': 792, 'n_words': 267}