Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when input text contains an empty line #96

Open
dlippold opened this issue Nov 12, 2023 · 0 comments
Open

Error when input text contains an empty line #96

dlippold opened this issue Nov 12, 2023 · 0 comments

Comments

@dlippold
Copy link

I have installed OPUS-MT on Ubuntu 22.04 as described on the project page (manual setup). I can translate some text by using the web site localhost:8888, for example from English to German. But when the input text contains an empty line I get the following error output an no text is translated:

Uncaught exception POST /api/translate (127.0.0.1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='POST', uri='/api/translate', version='HTTP/1.1', remote_ip='127.0.0.1')
Traceback (most recent call last):
File "/home/opusmt/.local/lib/python3.10/site-packages/tornado/web.py", line 1784, in _execute
result = method(*self.path_args, **self.path_kwargs)
File "/home/opusmt/Opus-MT/server.py", line 124, in post
translation = self.worker.translate(self.args['source'])
File "/home/opusmt/Opus-MT/server.py", line 30, in translate
sentences = self.contentprocessor.preprocess(text)
File "/home/opusmt/Opus-MT/content_processor.py", line 47, in preprocess
normalized_text = '\n'.join(self.normalizer(line) for line in srctxt.split('\n')) # normalizer do not accept '\n'
TypeError: sequence item 2: expected str instance, list found
500 POST /api/translate (127.0.0.1) 20.03ms

Is there a possibility to translate text with empty lines?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant