Exemplo n.º 1
0
    def feedback(self):

        """
        Return a dict stating that the memorandum was a text, not a word list;
        the first line or so of the text; the tokens (words) of the text; the
        unique words of the text sans the stopwords; the reading time of the
        text.
        """

        summary = {}

        summary["Memoranda_type"] = "Text"
        summary["Text_title"] = self.widget.title
        summary["Text_abbreviated"] = abbreviate_text(self.widget.text)
        summary["Text_tokens"] = tokenize(self.widget.text)
        summary["Text_keywords"] = nonstopword_unique_tokens(tokenize(self.widget.text))
        summary["Reading_time"] = self.reading_time

        return summary
Exemplo n.º 2
0
    def data_export(self):

        export_dict = super(SessionTextDisplay, self).data_export()

        for key, f in [
            ("Text ID", lambda: self.widget.text_uid),
            ("Title", lambda: self.widget.title),
            ("Text", lambda: self.widget.text),
            ("Text abbreviated", lambda: abbreviate_text(self.widget.text)),
            ("Text checksum", lambda: self.widget.text_checksum),
            ("Minimum reading time", lambda: self.widget.minimum_reading_time),
            ("Maximum reading_time", lambda: self.widget.maximum_reading_time),
            ("Text display start datetime", lambda: self.text_display_start),
            ("Text display stop datetime", lambda: self.text_display_stop),
            ("Reading time", lambda: self.reading_time),
        ]:

            export_dict, exception_raised, exception_msg = safe_export_data(export_dict, key, f)

            if exception_raised:
                logger.warning(exception_msg)

        return export_dict