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

Can't train model for polish language #3

Open
Manfed opened this issue Jan 16, 2018 · 8 comments
Open

Can't train model for polish language #3

Manfed opened this issue Jan 16, 2018 · 8 comments

Comments

@Manfed
Copy link

Manfed commented Jan 16, 2018

Hi,
I tried to run the code for polish language, but after downloading a data from wiki I've got an error:
python process_wiki.py ./data/pl/plwiki-latest-pages-articles.xml.bz2 ./data/pl/wiki.pl.text 2018-01-16 09:51:36,820: INFO: Running process_wiki.py ./data/pl/plwiki-latest-pages-articles.xml.bz2 ./data/pl/wiki.pl.text Traceback (most recent call last): File "process_wiki.py", line 43, in <module> output.write(" ".join(text) + "\n") UnicodeEncodeError: 'ascii' codec can't encode character u'\u0119' in position 20: ordinal not in range(128) make: *** [data/pl/wiki.pl.text] Error 1.

Is there any way to train model on unicode characters, not ascii?

@hgrif
Copy link
Owner

hgrif commented Jan 16, 2018

It works for me on Python 3, could you try that?

@Manfed
Copy link
Author

Manfed commented Jan 16, 2018

I've modified process_wiki.py file. I changed line 43 to output.write(" ".join(unicode(text)) + "\n")
After that the processing started without errors.

@hgrif
Copy link
Owner

hgrif commented Jan 16, 2018

Good to hear! Just to check: are you running Python 2 or 3?

@Manfed
Copy link
Author

Manfed commented Jan 16, 2018

I didn't change anything in my config and in project files. My default python version is 2.7, didn't notice that earlier :)
Probably if this will be run with Python 3 there will be no problems.

@hgrif
Copy link
Owner

hgrif commented Jan 16, 2018

Cool, I've added a note to the code for future reference.

@Manfed
Copy link
Author

Manfed commented Jan 16, 2018

Processing with my way is finished, but results are strange. model_pl.word2vec.model.txt file has only 42 vectors and most of them contains only 1 character. I'll try to run make with python3.
BTW I'm doing this on MAC if this makes some difference :)

EDIT: I changed a python version with command alias python='python3', but now I'm getting the first error message.

@hgrif
Copy link
Owner

hgrif commented Jan 16, 2018

Hm, that's weird: it does seem to work in Polish for me.

What's the result of:

$ python --version

@Manfed
Copy link
Author

Manfed commented Jan 16, 2018

Result is Python 3.6.3
Maybe is't something with my mac config?

EDIT: The same issue on the Ubuntu.

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

2 participants