Dmitry Kirsanov commited on
Commit
d66a76e
·
1 Parent(s): a9fdece

attr name fix

Browse files
Files changed (1) hide show
  1. understand.py +8 -6
understand.py CHANGED
@@ -192,7 +192,9 @@ Output the line "ACTORS:" followed by your list of actors, one per line.
192
 
193
  def annotate_actors(self):
194
  sents = sent_tokenize(self.values.get("FAD"))
195
- markup = "".join([f'<sentence actors="">{x}</sentence>' for x in sents])
 
 
196
 
197
  ret = self.query(
198
  f"""Below is a document inside <document></document>. It is a {self.values.get("document type")}.
@@ -208,17 +210,17 @@ A reader of this document has compiled a list of actors (parties) mentioned or i
208
 
209
  Your goal is to annotate each sentence of this document, inside a <sentence></sentence>, with its intended audience by picking one or more parties from this list. For each sentence, ask yourself: which of the parties from the list would want to know this sentence's information? Use only the parties from the list.
210
 
211
- Add the relevant partes, separated by commas, inside the "actors" atribute of each <sentence> tag. For example, suppose you have a document describing the game of Sudoku, and your parties are "Players" and "Creators". Here are example sentences with audience markup:
212
 
213
  <example>
214
- <sentence actors="Creators,Players">Sudoku is a popular logic puzzle with numbers with simple rules that even beginners can easily master.</sentence> <sentence actors="Creators">A presented puzzle with more than one possible solution would usually be considered defective.</sentence> <sentence actors="Players">If you have completed finding all positions for a number, draw an X over that number in the list outside.</sentence>
215
  </example>
216
 
217
- Output just the document with the audience markup after each sentence, but otherwise unchanged:
218
 
219
  <document>{markup}</document>""")
220
  annotated = self.parse_document(ret)
221
- self.values.put("FAD with actors", annotated)
222
 
223
 
224
  def ingest(self, filename):
@@ -244,7 +246,7 @@ Output just the document with the audience markup after each sentence, but other
244
  "=== Concepts:\n"+newline.join(["- " + x for x in self.values.get("concepts")]),
245
  "=== Actors:\n"+newline.join(["- " + x for x in self.values.get("actors")]),
246
  "=== Actors, generalized:\n"+newline.join(["- " + x for x in self.values.get("actors, generalized")]),
247
- "=== Document annotated:\n"+self.values.get("FAD with actors")
248
  )
249
 
250
 
 
192
 
193
  def annotate_actors(self):
194
  sents = sent_tokenize(self.values.get("FAD"))
195
+ markup = "".join([f'<sentence audience="">{x}</sentence>' for x in sents])
196
+
197
+ print(f"=== Sentence markup: {markup}")
198
 
199
  ret = self.query(
200
  f"""Below is a document inside <document></document>. It is a {self.values.get("document type")}.
 
210
 
211
  Your goal is to annotate each sentence of this document, inside a <sentence></sentence>, with its intended audience by picking one or more parties from this list. For each sentence, ask yourself: which of the parties from the list would want to know this sentence's information? Use only the parties from the list.
212
 
213
+ Add the relevant partes, separated by commas, inside the "audience" attribute of each <sentence> tag. For example, suppose you have a document describing the game of Sudoku, and your parties are "Players" and "Creators". Here are example sentences with audience markup:
214
 
215
  <example>
216
+ <sentence audience="Creators,Players">Sudoku is a popular logic puzzle with numbers with simple rules that even beginners can easily master.</sentence> <sentence audience="Creators">A presented puzzle with more than one possible solution would usually be considered defective.</sentence> <sentence audience="Players">If you have completed finding all positions for a number, draw an X over that number in the list outside.</sentence>
217
  </example>
218
 
219
+ Output just the document with the audience markup sentence, but otherwise unchanged:
220
 
221
  <document>{markup}</document>""")
222
  annotated = self.parse_document(ret)
223
+ self.values.put("FAD with audience", annotated)
224
 
225
 
226
  def ingest(self, filename):
 
246
  "=== Concepts:\n"+newline.join(["- " + x for x in self.values.get("concepts")]),
247
  "=== Actors:\n"+newline.join(["- " + x for x in self.values.get("actors")]),
248
  "=== Actors, generalized:\n"+newline.join(["- " + x for x in self.values.get("actors, generalized")]),
249
+ "=== Document annotated:\n"+self.values.get("FAD with audience")
250
  )
251
 
252