INNER CODE UNIT · Python

to_report_export_serializer_json

center-for-threat-informed-defense/tram · src/scripts/reformat_training_data.py:217

    def to_report_export_serializer_json(self):
        """Creates a dict that can be used to create
        a serializers.ReportExportSerializer instance
        """
        utc_now = datetime.utcnow().isoformat() + "Z"
        res_json = {
            "name": "Bootstrap Training Data",
            "text": "There is no text for this report. These sentences were mapped by human analysts.",
            "ml_model": "humans",
            "created_on": utc_now,
            "updated_on": utc_now,
            "sentences": [],
        }

        order = 0
        for sentence_text, mappings in self.mappings.items():
            if len(sentence_text.strip()) == 0:  # Skip empty sentences
                continue

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…