(specified_techniques=None, output_directory="generated_content")
write a csv linking techniques, software and groups.
    
    specifically, the output will link:
        techniques, to
        software implementing those techniques, to
        groups using the software

    arguments:
        specified_techniques: string[] of techniques to link. All other techniques will be ignored. If this argument is not specified 
                              it will output all techniques.
        output_directory: string. The folder the output data will be written to. The folder will be created if it doesn't already exist.
write a csv linking techniques, software and groups.
    
    specifically, the output will link:
        techniques, to
        software implementing those techniques, to
        groups using the software
write a csv linking techniques software and groups . specifically the output will link : techniques to software implementing those techniques to groups using the software
def write_TSG(specified_techniques=None, output_directory="generated_content"):
    """write a csv linking techniques, software and groups.
    
    specifically, the output will link:
        techniques, to
        software implementing those techniques, to
        groups using the software

    arguments:
        specified_techniques: string[] of techniques to link. All other techniques will be ignored. If this argument is not specified 
                              it will output all techniques.
        output_directory: string. The folder the output data will be written to. The folder will be created if it doesn't already exist.
    """

    filename = "tsg_subset.csv" if specified_techniques is not None else "tsg.csv"
    output_file = os.path.join(output_directory, filename)
    # Make sure the directory exists
    if not os.path.exists(output_directory):
        os.makedirs(output_directory)
    with open (output_file, "w") as output_file:
        # Write the header of the CSV
        output_file.write("technique,software,group\n")
        # only process techniques we want to output
        # if we don't specify any desired techniques, all techniques will be processed
        desired_techniques = list(filter(lambda t: specified_techniques is None or t in specified_techniques, tech_to_software))
        for tech in desired_techniques:
            for software in tech_to_software[tech]:
                # Some software may not be used by groups
                if software not in software_to_group:
                    continue
                for group in software_to_group[software]:
                    output_file.write(tech.lower() + "," + software.lower() + "," + group.lower() + "\n")
def write_TSG ( specified_techniques = None , output_directory = "generated_content" ) : filename = "tsg_subset.csv" if specified_techniques is not None else "tsg.csv" output_file = os . path . join ( output_directory , filename ) # Make sure the directory exists if not os . path . exists ( output_directory ) : os . makedirs ( output_directory ) with open ( output_file , "w" ) as output_file : # Write the header of the CSV output_file . write ( "technique,software,group\n" ) # only process techniques we want to output # if we don't specify any desired techniques, all techniques will be processed desired_techniques = list ( filter ( lambda t : specified_techniques is None or t in specified_techniques , tech_to_software ) ) for tech in desired_techniques : for software in tech_to_software [ tech ] : # Some software may not be used by groups if software not in software_to_group : continue for group in software_to_group [ software ] : output_file . write ( tech . lower ( ) + "," + software . lower ( ) + "," + group . lower ( ) + "\n" )