Compare commits

...

5 Commits

Author SHA1 Message Date
ibnaleem c9d41b93d5
Merge b6f2b60d91 into b82b3854cb 2024-10-17 20:51:51 -07:00
ibnaleem b6f2b60d91
add python script to search csv 2024-01-03 19:57:09 +00:00
ibnaleem df2445168d
initial commit 2024-01-03 19:55:11 +00:00
ibnaleem d140d000c9
Update main.py 2024-01-03 19:53:20 +00:00
ibnaleem 1c0c665c13
Create main.py 2024-01-03 19:52:16 +00:00
2 changed files with 25 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

25
scripts/main.py Normal file
View File

@ -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)