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
Merge requests
!214
Filter entities by name when extracting data from Arkindex
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Filter entities by name when extracting data from Arkindex
allow-unknown-entities
into
main
Overview
14
Commits
9
Pipelines
0
Changes
8
Merged
Manon Blanco
requested to merge
allow-unknown-entities
into
main
1 year ago
Overview
6
Commits
9
Pipelines
0
Changes
8
Expand
Closes
#134 (closed)
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
568f744d
9 commits,
1 year ago
8 files
+
312
−
79
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
Search (e.g. *.vue) (Ctrl+P)
dan/datasets/extract/__init__.py
+
23
−
1
Options
@@ -40,6 +40,15 @@ def validate_probability(proba):
return
proba
def
validate_char
(
char
):
if
len
(
char
)
!=
1
:
raise
argparse
.
ArgumentTypeError
(
f
"
`
{
char
}
` (of length
{
len
(
char
)
}
) is not a valid character. Must be a string of length 1.
"
)
return
char
def
add_extract_parser
(
subcommands
)
->
None
:
parser
=
subcommands
.
add_parser
(
"
extract
"
,
@@ -83,7 +92,20 @@ def add_extract_parser(subcommands) -> None:
# Optional arguments.
parser
.
add_argument
(
"
--load-entities
"
,
action
=
"
store_true
"
,
help
=
"
Extract text with their entities.
"
"
--load-entities
"
,
action
=
"
store_true
"
,
help
=
"
Extract text with their entities.
"
,
)
parser
.
add_argument
(
"
--entity-separators
"
,
type
=
validate_char
,
nargs
=
"
+
"
,
help
=
"""
Removes all text that does not appear in an entity or in the list of given ordered characters.
If several separators follow each other, keep only the first to appear in the list.
Do not give any arguments to keep the whole text.
"""
,
required
=
False
,
)
parser
.
add_argument
(
"
--tokens
"
,
Loading