Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
speller2
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nlpworkers
speller2
Commits
d69f437a
There was an error fetching the commit references. Please try again later.
Commit
d69f437a
authored
2 years ago
by
Tomasz Walkowiak
Browse files
Options
Downloads
Patches
Plain Diff
fixing typos
parent
7035bd0a
No related merge requests found
Pipeline
#9208
failed with stages
in 16 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/speller2_worker.py
+11
-7
11 additions, 7 deletions
src/speller2_worker.py
with
11 additions
and
7 deletions
src/speller2_worker.py
+
11
−
7
View file @
d69f437a
...
@@ -7,20 +7,24 @@ from autocorrect import Speller, Word
...
@@ -7,20 +7,24 @@ from autocorrect import Speller, Word
_log
=
logging
.
getLogger
(
__name__
)
_log
=
logging
.
getLogger
(
__name__
)
class
SpellerFixed
(
Speller
):
class
SpellerFixed
(
Speller
):
"""
Fixes orginal speller in case of long words
"""
"""
Fixes orginal speller in case of long words.
"""
def
__init__
(
self
,
lang
=
"
en
"
):
def
__init__
(
self
,
lang
=
"
en
"
):
"""
Call superclass.
"""
super
().
__init__
(
lang
)
super
().
__init__
(
lang
)
def
get_candidates
(
self
,
word
):
def
get_candidates
(
self
,
word
):
"""
Returns a list of possible candidate words.
"""
w
=
Word
(
word
,
self
.
lang
,
self
.
only_replacements
)
w
=
Word
(
word
,
self
.
lang
,
self
.
only_replacements
)
if
self
.
fast
or
len
(
word
)
>
15
:
if
self
.
fast
or
len
(
word
)
>
15
:
candidates
=
self
.
existing
([
word
])
or
self
.
existing
(
w
.
typos
())
or
[
word
]
candidates
=
self
.
existing
([
word
])
or
self
.
existing
(
w
.
typos
())
or
[
word
]
else
:
else
:
candidates
=
(
candidates
=
(
self
.
existing
([
word
])
self
.
existing
([
word
])
or
or
self
.
existing
(
w
.
typos
())
self
.
existing
(
w
.
typos
())
or
or
self
.
existing
(
w
.
double_typos
())
self
.
existing
(
w
.
double_typos
())
or
or
[
word
]
[
word
]
)
)
return
[(
self
.
nlp_data
.
get
(
c
,
0
),
c
)
for
c
in
candidates
]
return
[(
self
.
nlp_data
.
get
(
c
,
0
),
c
)
for
c
in
candidates
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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