Dmitry Kirsanov commited on
Commit
ce1ed78
·
1 Parent(s): cb60d07
Files changed (1) hide show
  1. understand.py +9 -8
understand.py CHANGED
@@ -197,14 +197,15 @@ Output the line "ACTORS:" followed by your list of actors, one per line.
197
  sents = re.split('</sentence>', llmtext)
198
  for i, sent in enumerate(sents):
199
  print(i, sent)
200
- match = re.match(f'[^<]*<sentence[^>]+{property}="([^"]+)"', sent)
201
- if match:
202
- vals = match.group(1)
203
- for val in re.split(",\s+", vals):
204
- print(f"property {property} val {val} notetype {notetype}")
205
- self.fad.add_property_to_mark(self.values.get("document"), "sentence", i + 1, property, val, notetype)
206
- else:
207
- raise(Exception(f"annotate_sentences_with_{property}: Bad markup from LLM: {sent}"))
 
208
 
209
 
210
  def annotate_sentences_with_actors(self, src="document", dst="document with actors"):
 
197
  sents = re.split('</sentence>', llmtext)
198
  for i, sent in enumerate(sents):
199
  print(i, sent)
200
+ if '<sentence' in sent:
201
+ match = re.match(f'[^<]*<sentence[^>]+{property}="([^"]+)"', sent)
202
+ if match:
203
+ vals = match.group(1)
204
+ for val in re.split(",\s+", vals):
205
+ print(f"property {property} val {val} notetype {notetype}")
206
+ self.fad.add_property_to_mark(self.values.get("document"), "sentence", i + 1, property, val, notetype)
207
+ else:
208
+ raise(Exception(f"annotate_sentences_with_{property}: Bad markup from LLM: {sent}"))
209
 
210
 
211
  def annotate_sentences_with_actors(self, src="document", dst="document with actors"):