From 1c0c665c135962f66e78f23e098becf0b93ed6a1 Mon Sep 17 00:00:00 2001 From: ibnaleem Date: Wed, 3 Jan 2024 19:52:16 +0000 Subject: [PATCH] Create main.py --- scripts/main.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 scripts/main.py diff --git a/scripts/main.py b/scripts/main.py new file mode 100644 index 0000000..b7b8e88 --- /dev/null +++ b/scripts/main.py @@ -0,0 +1,25 @@ +import pandas as pd, sys + +class PromptFinder: + def __init__(self, csv_file): + self.df = pd.read_csv(csv_file) + + def find(self, search_string): + result = self.df[self.df["act"] == search_string]["prompt"].values + + if len(result) > 0: + return result[0] + else: + return f"No prompt found for '{search_string}'." + + +if __name__ == "__main__": + prompt_finder = PromptFinder("./prompts.csv") + if not sys.stdin.isatty(): + act_to_search = sys.stdin.readline().rstrip() + else: + act_to_search = input("Enter the ACT to search for: ") + + prompt_result = prompt_finder.find(act_to_search) + + print(prompt_result)