Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lexworkers
polem
Commits
0b293cb8
Commit
0b293cb8
authored
Jul 3, 2020
by
leszeks
Browse files
Options
Downloads
Patches
Plain Diff
CI addition, slight code modification
parent
030555b5
No related branches found
No related tags found
1 merge request
!4
Polem2rancher
Pipeline
#596
failed
Jul 3, 2020
Stage: check_style
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
polem_lemmatizer.py
+14
-11
14 additions, 11 deletions
polem_lemmatizer.py
with
14 additions
and
11 deletions
polem_lemmatizer.py
+
14
−
11
View file @
0b293cb8
"""
Implementation of polem service.
"""
import
WrapLem
import
WrapLem
import
lex_ws
import
lex_ws
class
Polem
(
lex_ws
.
LexWorker
):
class
Polem
(
lex_ws
.
LexWorker
):
"""
Implements lex_worker for polem service. It
'
s a mock object.
"""
@classmethod
@classmethod
def
static_init
(
cls
,
config
):
def
static_init
(
cls
,
config
):
"""
Class constructor.
"""
pass
pass
@classmethod
@classmethod
def
static_close
(
cls
):
def
static_close
(
cls
):
"""
.
"""
pass
pass
def
init
(
self
):
def
init
(
self
):
"""
Initializes lemmatizer.
"""
self
.
_lemmatizer
=
WrapLem
.
CascadeLemmatizer
.
assembleLemmatizer
()
self
.
_lemmatizer
=
WrapLem
.
CascadeLemmatizer
.
assembleLemmatizer
()
def
processold
(
self
,
task_options
):
output
=
[]
for
lexeme
in
task_options
[
'
lexeme_polem
'
]:
output
.
append
(
self
.
_lemmatizer
.
lemmatizeS
(
lexeme
[
0
],
lexeme
[
1
],
lexeme
[
2
],
False
))
return
output
def
process
(
self
,
task_options
):
def
process
(
self
,
task_options
):
"""
Runs single polem task.
"""
output
=
[]
output
=
[]
for
lexeme
in
task_options
[
'
lexeme_polem
'
]:
for
lexeme
in
task_options
[
'
lexeme_polem
'
]:
if
len
(
lexeme
)
==
3
:
if
len
(
lexeme
)
==
3
:
output
.
append
(
self
.
_lemmatizer
.
lemmatizeS
(
lexeme
[
0
],
lexeme
[
1
],
lexeme
[
2
],
False
))
output
.
append
(
self
.
_lemmatizer
.
lemmatizeS
(
lexeme
[
0
],
lexeme
[
1
],
lexeme
[
2
],
False
))
elif
len
(
lexeme
)
==
5
:
elif
len
(
lexeme
)
==
5
:
output
.
append
(
self
.
_lemmatizer
.
lemmatizeS
(
lexeme
[
0
],
lexeme
[
1
],
lexeme
[
2
],
lexeme
[
3
],
lexeme
[
4
],
False
))
output
.
append
(
self
.
_lemmatizer
.
lemmatizeS
(
lexeme
[
0
],
lexeme
[
1
],
lexeme
[
2
],
lexeme
[
3
],
lexeme
[
4
],
False
))
else
:
else
:
raise
Exception
(
"
Invalid number of arguments
"
)
raise
Exception
(
"
Invalid number of arguments
"
)
return
output
return
output
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
lex_ws
.
LexService
.
main
(
Polem
)
lex_ws
.
LexService
.
main
(
Polem
)
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