Closed arturovivas closed 7 years ago
There's a typo in your code. The word "text" was misspelled as "test" :
page = element.findtext('./{*}revision/{*}test')
Should be
page = element.findtext('./{*}revision/{*}text')
Let me know if that change works.
You'll also need to import random
at the top for the skipgrams function.
Hi @arturovivas - could you confirm whether this worked or not? If so, I can close the issue.
Hi @samjabrahams Thanks for the replay! I was checking it today and it works. I confirm that this version is now working in python 2.7. I also performed some minor changes. I will upload tomorrow the code to my repository in the case you want to copy it and create a folder in the official book repository for the py 2.7 Version. My goal is to finish your book with the py2.7 version. So I will continue uploading the other codes as soon as I finish with them.
Great, glad that this worked out for you. Thanks for keeping us updated with your code!
Hi Guys,
I've been using the book in the last days and now I arrived at Ch 6. I am struggling to make the code from the section Word Vector Embeddings work using python 2.7.
Until now I have changed a few things, i.e.
bz2.open()
occurrences replaced withbz2.BZ2File()
from urllib.request import urlopen
replaced withfrom urllib import urlopen
Now I am stuck with the
_read_pages(self, url)
method... This is the error that get.I copied the code to my repository <-- Thanks for helping out!