Dmitry Kirsanov commited on
Commit
8552f4e
·
1 Parent(s): 679c356
Files changed (1) hide show
  1. understand.py +2 -2
understand.py CHANGED
@@ -183,9 +183,9 @@ Output the line "ACTORS:" followed by your list of actors, one per line.
183
  sents = nltk.tokenize.sent_tokenize(plaintext)
184
  i = 0
185
  for sent in sents:
186
- start = plaintext.find(plaintext, i)
187
  if start == -1:
188
- raise(Exception("ERROR:nltk.tokenize.sent_tokenize output does not cleanly match source"))
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)
 
183
  sents = nltk.tokenize.sent_tokenize(plaintext)
184
  i = 0
185
  for sent in sents:
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)