INNER CODE UNIT · Python
main
center-for-threat-informed-defense/tram · src/scripts/reformat_training_data.py:260
def main():
with open("data/training/archive/all_analyzed_reports.json") as f:
all_analyzed_reports = json.load(f)
with open("data/training/archive/negative_data.json") as f:
negative_data = json.load(f)
training_data = TrainingData()
# Add the positives
for key, value in all_analyzed_reports.items():
if key.endswith("-multi"): # It's a multi-mapping, value is a dictionary
for sentence in value[
"sentances"
]: # Sentences is misspelled in the source data
map(
partial(training_data.add_mapping, sentence),
[ATTACK_LOOKUP[name.lower()] for name in value["technique_names"]],