Dmitry Kirsanov commited on
Commit
3692d5a
·
1 Parent(s): 9334bee

more list fixing

Browse files
Files changed (1) hide show
  1. understand.py +9 -5
understand.py CHANGED
@@ -65,7 +65,6 @@ Give a one-paragraph summary of the document's content. Write just one paragraph
65
  item = line[2:].strip()
66
  else:
67
  item = line
68
- print(f"---item: {item}")
69
  retlist.append(item)
70
 
71
  print(f"===Parsed list {what}: {retlist}")
@@ -108,7 +107,10 @@ Here's the document:
108
  attempt["concepts"] = self.parse_lists(ret, "concepts")
109
  attempt["actors"] = self.parse_lists(ret, "actors")
110
 
 
 
111
  #reconcile two lists
 
112
  for what in [
113
  {'plural': "concepts", 'singular': "concept", 'full': "concepts that this document talks about"},
114
  {'plural': "actors", 'singular': "actor", 'full': "actors described or implied in the document"}
@@ -139,12 +141,14 @@ Output the line "{what['plural'].upper()}:" followed by your combined list of {w
139
  Here's the document:
140
 
141
  <document>{self.values.get("FAD")}</document>""")
142
- two_attempts[0][what['plural']] = self.parse_lists(ret, what['plural'])
143
- print(f"===Reconciled {what['plural']}: {two_attempts[0][what['plural']]}")
144
 
145
  # finally store in the values
146
- self.values.put("concepts", two_attempts[0]["concepts"])
147
- self.values.put("actors", two_attempts[0]["actors"])
 
 
148
 
149
 
150
  def ingest(self, filename):
 
65
  item = line[2:].strip()
66
  else:
67
  item = line
 
68
  retlist.append(item)
69
 
70
  print(f"===Parsed list {what}: {retlist}")
 
107
  attempt["concepts"] = self.parse_lists(ret, "concepts")
108
  attempt["actors"] = self.parse_lists(ret, "actors")
109
 
110
+ print(f"===Reconcile: {two_attempts}")
111
+
112
  #reconcile two lists
113
+ reconciled = {"actors": [], "concepts": []}
114
  for what in [
115
  {'plural': "concepts", 'singular': "concept", 'full': "concepts that this document talks about"},
116
  {'plural': "actors", 'singular': "actor", 'full': "actors described or implied in the document"}
 
141
  Here's the document:
142
 
143
  <document>{self.values.get("FAD")}</document>""")
144
+ reconciled[what['plural']] = self.parse_lists(ret, what['plural'])
145
+ print(f"===Reconciled {what['plural']}: {reconciled[what['plural']]}")
146
 
147
  # finally store in the values
148
+ self.values.put("concepts", reconciled["concepts"])
149
+ self.values.put("actors", reconciled["actors"])
150
+
151
+ print(f"===Reconciled: Concepts: {self.values.get("concepts")}, Actors: {self.values.get("concepts")}")
152
 
153
 
154
  def ingest(self, filename):