Skip to content
Snippets Groups Projects
Commit 99590a15 authored by Alice Brenon's avatar Alice Brenon
Browse files

Clean left-overs in the code

parent a8ce8b82
No related branches found
No related tags found
No related merge requests found
...@@ -75,13 +75,11 @@ class Annotator: ...@@ -75,13 +75,11 @@ class Annotator:
try: try:
with open(outputFile, 'w') as target: with open(outputFile, 'w') as target:
for paragraph in document.split('\n\n'): for paragraph in document.split('\n\n'):
# print(f'# newpar id = {self.newpar()}', file=target)
self.annotate_paragraph(paragraph, target) self.annotate_paragraph(paragraph, target)
except Exception: except Exception:
print("Failed trying " + outputFile) print("Failed trying " + outputFile)
os.unlink(outputFile) os.unlink(outputFile)
sys.exit(1) sys.exit(1)
def annotate_paragraph(self, paragraph, target): def annotate_paragraph(self, paragraph, target):
parsed = self.model(paragraph) parsed = self.model(paragraph)
...@@ -89,6 +87,7 @@ class Annotator: ...@@ -89,6 +87,7 @@ class Annotator:
print(f'# newpar id = {self.newpar()}', file=target) print(f'# newpar id = {self.newpar()}', file=target)
for sentence in parsed.sentences: for sentence in parsed.sentences:
print(self.annotate_sentence(sentence), file=target) print(self.annotate_sentence(sentence), file=target)
def annotate_sentence(self, sentence): def annotate_sentence(self, sentence):
return "\n".join( return "\n".join(
[f'# sent_id = {self.newsent()}', [f'# sent_id = {self.newsent()}',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment