def to_string()

in emoclassifiers/chunking.py [0:0]


    def to_string(self, include_start_indicator: bool = True, do_truncate: bool = False) -> str:
        """
        Convert a chunk to a string.
        """
        elems = []
        if include_start_indicator and self.touches_start:
            elems.append("(This is the start of the conversation.)")
        for i, message in enumerate(self.chunk):
            content = message["content"].strip()
            if do_truncate:
                content = truncate_string(content, sep="[[...Long Message Truncated...]]")
            elems.append(
                '[{marker}{role}{marker}] "{content}"'.format(
                    marker="*" if i == len(self.chunk) - 1 else "",
                    role=message["role"].upper(),
                    content=content,
                )
            )
        return "\n".join(elems)