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
1
All threads resolved!
Hide all comments
Merged
Solene Tarride
requested to merge
subword-and-word-lm
into
main
1 year ago
Overview
34
Commits
47
Pipelines
0
Changes
1
All threads resolved!
Hide all comments
Expand
Closes
#199 (closed)
Ref
https://redmine.teklia.com/issues/4941
0
0
Merge request reports
Viewing commit
1e3d7156
Prev
Next
Show latest version
1 file
+
4
−
3
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
1e3d7156
Encode text before checking for unknown characters
· 1e3d7156
Solene Tarride
authored
1 year ago
dan/datasets/extract/utils.py
+
4
−
3
Options
@@ -226,9 +226,10 @@ class Tokenizer:
:param text: Text to be tokenized.
"""
return
"
"
.
join
(
self
.
encode
(
[
char
if
char
in
self
.
charset
else
self
.
unknown_token
for
char
in
text
]
)
[
char
if
char
in
self
.
charset
else
self
.
unknown_token
for
char
in
self
.
encode
(
text
)
]
)
def
encode
(
self
,
text
:
List
[
str
])
->
List
[
str
]:
Loading