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
!287
Support subword and word language models
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Support subword and word language models
subword-and-word-lm
into
main
Overview
34
Commits
47
Pipelines
0
Changes
7
Merged
Solene Tarride
requested to merge
subword-and-word-lm
into
main
1 year ago
Overview
34
Commits
47
Pipelines
0
Changes
7
Expand
Closes
#199 (closed)
Ref
https://redmine.teklia.com/issues/4941
0
0
Merge request reports
Viewing commit
9a638552
Show latest version
7 files
+
29
−
20
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
7
Search (e.g. *.vue) (Ctrl+P)
9a638552
Improve code, typing and logging
· 9a638552
Solene Tarride
authored
1 year ago
dan/datasets/extract/extract.py
+
3
−
6
Options
@@ -279,12 +279,7 @@ class ArkindexExtractor:
"""
Format text for the language model. Return the text tokenized at character-level.
"""
return
"
"
.
join
(
[
self
.
mapping
.
encode
[
token
]
if
token
in
self
.
mapping
.
encode
else
token
for
token
in
list
(
text
.
strip
())
]
)
return
"
"
.
join
(
map
(
self
.
mapping
.
encode_token
,
list
(
text
.
strip
())))
def
process_element
(
self
,
@@ -323,6 +318,8 @@ class ArkindexExtractor:
self
.
data
[
split
][
str
(
image_path
)]
=
text
self
.
charset
=
self
.
charset
.
union
(
set
(
text
))
# Language model should be built using only text from the training set
if
split
==
"
train
"
:
self
.
language_corpus
.
append
(
self
.
format_text_language_model
(
text
))
Loading