Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DAN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Automatic Text Recognition
DAN
Commits
d52df58b
Commit
d52df58b
authored
1 year ago
by
Manon Blanco
Committed by
Yoann Schneider
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Use a random transcription of an element when more than one found
parent
67f28861
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!180
Use a random transcription of an element when more than one found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dan/datasets/extract/exceptions.py
+0
-9
0 additions, 9 deletions
dan/datasets/extract/exceptions.py
dan/datasets/extract/extract.py
+2
-5
2 additions, 5 deletions
dan/datasets/extract/extract.py
with
2 additions
and
14 deletions
dan/datasets/extract/exceptions.py
+
0
−
9
View file @
d52df58b
...
...
@@ -49,15 +49,6 @@ class NoTranscriptionError(ElementProcessingError):
return
f
"
No transcriptions found on element (
{
self
.
element_id
}
) with this config. Skipping.
"
class
MultipleTranscriptionsError
(
ElementProcessingError
):
"""
Raised when there are more than one transcription on an element
"""
def
__str__
(
self
)
->
str
:
return
f
"
More than one transcription found on element (
{
self
.
element_id
}
) with this config.
"
class
UnknownLabelError
(
ProcessingError
):
"""
Raised when the specified label is not known
...
...
This diff is collapsed.
Click to expand it.
dan/datasets/extract/extract.py
+
2
−
5
View file @
d52df58b
...
...
@@ -18,7 +18,6 @@ from dan.datasets.extract.db import (
get_transcriptions
,
)
from
dan.datasets.extract.exceptions
import
(
MultipleTranscriptionsError
,
NoTranscriptionError
,
ProcessingError
,
UnknownLabelError
,
...
...
@@ -129,12 +128,10 @@ class ArkindexExtractor:
transcriptions
=
get_transcriptions
(
element
.
id
,
self
.
transcription_worker_version
)
if
len
(
transcriptions
)
>
1
:
raise
MultipleTranscriptionsError
(
element
.
id
)
elif
len
(
transcriptions
)
==
0
:
if
len
(
transcriptions
)
==
0
:
raise
NoTranscriptionError
(
element
.
id
)
transcription
=
transcriptions
.
pop
(
)
transcription
=
random
.
choice
(
transcriptions
)
if
self
.
load_entities
:
entities
=
get_transcription_entities
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment