dataset_preparer/descer.py

12 lines
510 B
Python
Executable File

#!/usr/bin/env python
import sys
def descer(doc_text: str, doc_label: str):
''' adds descriptive labels on top and bottom of doc_text, and returns the resulting complete text with the aforementioned descriptive labels'''
return "The following text is about " + doc_label + "\n\n" + doc_text + "\n\nThis is the end of "+ doc_label + " text\n"
# if run as shell command, takes stdin as input, stdout as output
if __name__ == "__main__":
print(descer(sys.stdin.read(), ' '.join(sys.argv[1:])))