Dmitry Kirsanov commited on
Commit
cb60d07
·
1 Parent(s): d156f9c
Files changed (1) hide show
  1. understand.py +2 -2
understand.py CHANGED
@@ -186,7 +186,7 @@ Output the line "ACTORS:" followed by your list of actors, one per line.
186
  start = plaintext.find(sent, i)
187
  if start == -1:
188
  raise(Exception(f"ERROR:nltk.tokenize.sent_tokenize output does not cleanly match source: can't find '{sent}' in '{plaintext[i:]}'"))
189
- newfad = self.fad.add_span_mark(newfad, "sentence", start, start+len(sent) - 1)
190
  i = start+len(sent)
191
  self.values.put(dst, newfad)
192
  print(f"=== Sentence-split FAD : {newfad}")
@@ -197,7 +197,7 @@ 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'\s*<sentence[^>]+{property}="([^"]+)"', sent)
201
  if match:
202
  vals = match.group(1)
203
  for val in re.split(",\s+", vals):
 
186
  start = plaintext.find(sent, i)
187
  if start == -1:
188
  raise(Exception(f"ERROR:nltk.tokenize.sent_tokenize output does not cleanly match source: can't find '{sent}' in '{plaintext[i:]}'"))
189
+ newfad = self.fad.add_span_mark(newfad, "sentence", start, start+len(sent))
190
  i = start+len(sent)
191
  self.values.put(dst, newfad)
192
  print(f"=== Sentence-split FAD : {newfad}")
 
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):