From 1c0c665c135962f66e78f23e098becf0b93ed6a1 Mon Sep 17 00:00:00 2001 From: ibnaleem Date: Wed, 3 Jan 2024 19:52:16 +0000 Subject: [PATCH 1/4] 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) From d140d000c95033c7df83efb4ed36f6bd5e5e8641 Mon Sep 17 00:00:00 2001 From: ibnaleem Date: Wed, 3 Jan 2024 19:53:20 +0000 Subject: [PATCH 2/4] Update main.py --- scripts/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/main.py b/scripts/main.py index b7b8e88..1958a93 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -14,7 +14,7 @@ class PromptFinder: if __name__ == "__main__": - prompt_finder = PromptFinder("./prompts.csv") + prompt_finder = PromptFinder("../prompts.csv") if not sys.stdin.isatty(): act_to_search = sys.stdin.readline().rstrip() else: From df2445168dd728ec6eb81ff465db6abc89ee6759 Mon Sep 17 00:00:00 2001 From: ibnaleem Date: Wed, 3 Jan 2024 19:55:11 +0000 Subject: [PATCH 3/4] initial commit --- scripts/main.py | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 scripts/main.py diff --git a/scripts/main.py b/scripts/main.py deleted file mode 100644 index 1958a93..0000000 --- a/scripts/main.py +++ /dev/null @@ -1,25 +0,0 @@ -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) From b6f2b60d917e380abbb2868f0e69dffb6318bfc9 Mon Sep 17 00:00:00 2001 From: ibnaleem Date: Wed, 3 Jan 2024 19:57:09 +0000 Subject: [PATCH 4/4] add python script to search csv --- .DS_Store | Bin 0 -> 6148 bytes scripts/main.py | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 .DS_Store create mode 100644 scripts/main.py diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ce30cdf93ed5d6da7b0e8fe2a6d1435f1cfe9acc GIT binary patch literal 6148 zcmeHK%Zd|06umW*F&%@Lg#)t@8r+64PR0Ro6Z1d-IfOS9KAQXioe0h$=+npfDD$qq@R)p38>q zm=X39YK`|4(K#K`B@H*&cEBoN75Li};BU7~KJ`daLhIje+>K=~jAaN0Zx4@94u2{` zi?;-yVhZrBOPW$jlN|qRj=x7OdWKb=QYXt4w{y&!U_J-;j83UbO?rV=7yZZBS%%cl zd4JA%7wHMuE$YC-+lcie$1c-|#>ij@L=K41Lw%8rp>qGSmU{_L*1>3-v$^W2h_he! zC}PzfB1Jk*c73J5AK2k+GBR)CTR4iNNm{FY7dyL!y=z6M=#-te-Um7J(jc8qn!)%r z_s*n@!&N&7Uq*wOU%AziNg71SV5}UX{s5FWucD+cXH7Xx`V-~r=?SOgl>ExUe12TN zUv=w8CyS~(e{fW*y2tgC#iHcw-?{tn)c+U{6Zr}G!UWC%Wj742fZtM1g9~q*#4lztLP*e8f|SAunJ@q*wx(% zpZ}fT-~Y2twr3Tv3j9|Jh(g 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) \ No newline at end of file