Skip to content
Snippets Groups Projects
Commit 0b293cb8 authored by leszeks's avatar leszeks
Browse files

CI addition, slight code modification

parent 030555b5
No related branches found
No related tags found
1 merge request!4Polem2rancher
Pipeline #596 failed
"""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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment