Skip to content

Conversation

@Syed-Mohd-Hubab
Copy link

@Syed-Mohd-Hubab Syed-Mohd-Hubab commented Mar 30, 2021

The method _stem takes a word and checks if the encoding is in unicode. This was the syntax in older python versions. As I tried running this on my Python 3 project, it showed ''''NameError: name 'unicode' is not defined''' because unicode is deprecated.

  • In Python 2, str contains sequences of 8-bit values, unicode contains sequences of Unicode characters.
  • In Python 3, bytes contains sequences of 8-bit values, str contains sequences of Unicode characters.

NOTE: This will work perfectly for Python 3.

…Python 3

The method _stem takes a word and checks if the encoding is in unicode. This was the syntax in older python versions. As I tried running this on my Python 3 project, it showed ''''NameError: name 'unicode' is not defined''' because unicode is deprecated.

- In Python 2, str contains sequences of 8-bit values, unicode contains sequences of Unicode characters.
- In Python 3, bytes contains sequences of 8-bit values, str contains sequences of Unicode characters. 

NOTE: This will work perfectly for Python 3.
@mdirolf
Copy link
Owner

mdirolf commented Mar 30, 2021

Will this continue to work for python 2? It'd be nice to have the project support both, though I suppose it's probably time to make the switch

@Syed-Mohd-Hubab
Copy link
Author

Syed-Mohd-Hubab commented Mar 30, 2021

Well, it wont. bytes would work only in Python 3.X The reason being it was deprecated. Yeah same I think python 2
But, we would need something like this to keep it compatible for both versions.

import sys
if sys.version_info[0] >= 3:
    unicode = bytes

But this would not be implemented in the isinstance() function directly.

In my opinion, we could keep master repository updated along with Python 3 standards.
Do let me know your opinion in this.
Thanks 💯

@Syed-Mohd-Hubab
Copy link
Author

Hey @mdirolf what do you think 🤓

@mdirolf
Copy link
Owner

mdirolf commented Apr 2, 2021

Right now this doesn't pass the tests. If you run python Stemmer.py it'll run the test suite - once that's passing I'm OK w/ merging this and updating to python 3

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

Successfully merging this pull request may close these issues.

2 participants