r"""Single text generator for role-playing workers. Args: text_file_path (str): The path to the file containing the text data.
| 283 | |
| 284 | |
| 285 | class SingleTxtGenerator: |
| 286 | r"""Single text generator for role-playing workers. |
| 287 | |
| 288 | Args: |
| 289 | text_file_path (str): The path to the file containing the text data. |
| 290 | """ |
| 291 | |
| 292 | def __init__( |
| 293 | self, |
| 294 | text_file_path: str, |
| 295 | ) -> None: |
| 296 | with open(text_file_path, "r") as f: |
| 297 | data_list: List[str] = f.read().splitlines() |
| 298 | self.data_list = [ |
| 299 | " ".join(name.split(" ")[1:]) for name in data_list |
| 300 | ] |
| 301 | |
| 302 | def from_role_files(self) -> Generator[str, None, None]: |
| 303 | r"""Generate text from the file. |
| 304 | |
| 305 | Returns: |
| 306 | Generator[str, None, None]: A generator that yields the text data. |
| 307 | """ |
| 308 | for data in self.data_list: |
| 309 | yield data |
| 310 | |
| 311 | |
| 312 | class CodeTaskPromptGenerator: |