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

Fixed two CSV tasks #124

Closed
wants to merge 3 commits into from
Closed
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
4 changes: 2 additions & 2 deletions src/run_single.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import logging

TURKLE_URL = "http://localhost:8000"
TEST_NAME = "Annotation subj_obj"
SPECIFIED_INDEX = 46
TEST_NAME = "atomic_event2event-effects 4"
SPECIFIED_INDEX = 112
RUN_ALL = False

class Run(evaluation_class.Evaluation):
Expand Down
8 changes: 4 additions & 4 deletions src/utils/clean_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ def clean_empty(csv_file):
df = pd.read_csv(csv_file, low_memory=False)
for i, row in df.iterrows():
for col in df.columns:
if not (col.startswith("Answer.") and col.endswith("subject")):
if col.startswith("Answer."):
continue
if pd.isnull(row[col]) or row[col] == "":
df.loc[i, col] = "--NO SUBJECT--"
df.loc[i, col] = " "
df.to_csv(csv_file , encoding='utf-8-sig', index=False)

# Make certain columns empty if not specific values
Expand Down Expand Up @@ -125,10 +125,10 @@ def clean_unempty(csv_file):
df.to_csv(csv_file , encoding='utf-8-sig', index=False)

if __name__ == '__main__':
files_to_edit = ["Annotation subj_obj"]
files_to_edit = ["winogrande validation (grammar) additional_ph", "atomic_event2event-effects 4"]
for root, dirs, files in os.walk('tasks'):
for file in files:
if file.endswith('.csv') and file.startswith('batch'):
if root.split("/")[1] in files_to_edit:
print('Cleaning ' + os.path.join(root, file))
make_empty(os.path.join(root, file))
clean_empty(os.path.join(root, file))
Loading
Loading