Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python script to find prompts using act #718

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
25 changes: 25 additions & 0 deletions scripts/main.py
Original file line number Diff line number Diff line change
@@ -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)