kateforsberg commited on
Commit
2d7d9df
·
1 Parent(s): bde40e8

remove similarity step stuff again

Browse files
Files changed (1) hide show
  1. uw_programmatic/uw_machine.py +0 -50
uw_programmatic/uw_machine.py CHANGED
@@ -24,8 +24,6 @@ class UWMachine(UWBaseMachine):
24
  """Starts the machine."""
25
  # Clear input history.
26
  # Clear csv file
27
- with Path(Path.cwd().joinpath("outputs/similarity_step.csv")).open("w") as file:
28
- file.write("")
29
  self.send("enter_first_state")
30
 
31
  def on_event_gather_parameters(self, event_: dict) -> None:
@@ -83,21 +81,6 @@ class UWMachine(UWBaseMachine):
83
  def on_enter_assess_generated_q(self) -> None:
84
  # TODO: Should it append it to the list already and remove duplicates? or not?
85
  # TODO: Merge incoming lists
86
- with Path(Path.cwd().joinpath("outputs/similarity_step.csv")).open(
87
- "a", newline=""
88
- ) as file:
89
- writer = csv.DictWriter(
90
- file,
91
- fieldnames=[
92
- "Question",
93
- "Answer",
94
- "Wrong Answers",
95
- "Page",
96
- "Taxonomy",
97
- ],
98
- )
99
- writer.writerow({"Question": "LIST OF QUESTIONS GENERATED THIS ROUND"})
100
- writer.writerows(self.most_recent_questions)
101
  merged_list = [*self.question_list, *self.most_recent_questions]
102
  prompt = f"{merged_list}"
103
  self.get_structure("similarity_auditor").run(prompt)
@@ -122,38 +105,6 @@ class UWMachine(UWBaseMachine):
122
  ) # This must be in that JSON format
123
  except:
124
  new_question_list = self.question_list
125
- merged_list = [
126
- *self.question_list,
127
- *self.most_recent_questions,
128
- ]
129
- deleted_q = [
130
- question1
131
- for question1 in merged_list
132
- if not any(
133
- question2["Question"] == question1["Question"]
134
- for question2 in new_question_list
135
- )
136
- ]
137
- with Path(
138
- Path.cwd().joinpath("outputs/similarity_step.csv")
139
- ).open("a", newline="") as file:
140
- writer = csv.DictWriter(
141
- file,
142
- fieldnames=[
143
- "Question",
144
- "Answer",
145
- "Wrong Answers",
146
- "Page",
147
- "Taxonomy",
148
- ],
149
- )
150
- writer.writerow(
151
- {"Question": "QUESTIONS REMOVED THIS ROUND!"}
152
- )
153
- if len(deleted_q):
154
- writer.writerows(deleted_q)
155
- else:
156
- writer.writerow({"Question": "No q removed"})
157
  self.question_list = new_question_list
158
  self.send("next_state") # move on
159
 
@@ -163,7 +114,6 @@ class UWMachine(UWBaseMachine):
163
  ) as file:
164
  writer = csv.writer(file)
165
  for question in range(len(self.question_list)):
166
- # TODO: Shuffle answers according to row, keep correct answer in random section. Answer column is a number.
167
  new_row = ["MC", "", 1]
168
  new_row.append(self.question_list[question]["Question"])
169
  wrong_answers = list(self.question_list[question]["Wrong Answers"])
 
24
  """Starts the machine."""
25
  # Clear input history.
26
  # Clear csv file
 
 
27
  self.send("enter_first_state")
28
 
29
  def on_event_gather_parameters(self, event_: dict) -> None:
 
81
  def on_enter_assess_generated_q(self) -> None:
82
  # TODO: Should it append it to the list already and remove duplicates? or not?
83
  # TODO: Merge incoming lists
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  merged_list = [*self.question_list, *self.most_recent_questions]
85
  prompt = f"{merged_list}"
86
  self.get_structure("similarity_auditor").run(prompt)
 
105
  ) # This must be in that JSON format
106
  except:
107
  new_question_list = self.question_list
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  self.question_list = new_question_list
109
  self.send("next_state") # move on
110
 
 
114
  ) as file:
115
  writer = csv.writer(file)
116
  for question in range(len(self.question_list)):
 
117
  new_row = ["MC", "", 1]
118
  new_row.append(self.question_list[question]["Question"])
119
  wrong_answers = list(self.question_list[question]["Wrong Answers"])