Spaces:
Runtime error
Runtime error
Dmitry Kirsanov commited on
Commit ·
ce1ed78
1
Parent(s): cb60d07
more fix
Browse files- 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 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
|
|
|
| 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"):
|