Skip to content
Snippets Groups Projects

Report Transcription Entity creation

Merged Thibault Lavigne requested to merge 157-report-transcription-entity-creation into master
All threads resolved!
4 files
+ 162
24
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -96,7 +96,7 @@ class EntityMixin(object):
def create_transcription_entity(
self,
transcription: str,
transcription: Transcription,
entity: str,
offset: int,
length: int,
@@ -106,7 +106,7 @@ class EntityMixin(object):
Create a link between an existing entity and an existing transcription.
If cache support is enabled, a `CachedTranscriptionEntity` will also be created.
:param transcription: UUID of the existing transcription.
:param transcription: Transcription to create the entity on.
:param entity: UUID of the existing entity.
:param offset: Starting position of the entity in the transcription's text,
as a 0-based index.
@@ -116,8 +116,8 @@ class EntityMixin(object):
or None if the worker is in read-only mode.
"""
assert transcription and isinstance(
transcription, str
), "transcription shouldn't be null and should be of type str"
transcription, Transcription
), "transcription shouldn't be null and should be a Transcription"
assert entity and isinstance(
entity, str
), "entity shouldn't be null and should be of type str"
@@ -147,16 +147,16 @@ class EntityMixin(object):
transcription_ent = self.request(
"CreateTranscriptionEntity",
id=transcription,
id=transcription.id,
body=body,
)
# TODO: Report transcription entity creation
self.report.add_transcription_entity(entity, transcription, transcription_ent)
if self.use_cache:
# Store transcription entity in local cache
try:
CachedTranscriptionEntity.create(
transcription=transcription,
transcription=transcription.id,
entity=entity,
offset=offset,
length=length,
Loading