You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the load function in pattern.text.en.parser.sentiment is given an optional path, it sets the '_path' attribute of the Lexicon object, whereas in all other locations the 'path' attribute (without the underscore) is referenced. If the underscore is removed from load, everything works as expected. I posted a more detailed explanation to a relevant google groups thread, which should hopefully be approved soon.
Here is the load function:
def load(self, path=None):
# Backwards compatibility with pattern.en.wordnet.Sentiment.
if path is not None:
self._path = path
self._parse()
Here is where the path attribute is intended to be used, in SentiWordNet._parse_path:
def _parse_path(self):
""" For backwards compatibility, look for SentiWordNet*.txt in:
pattern/en/parser/, patter/en/wordnet/, or the given path.
"""
try: f = (
glob(os.path.join(self.path)) +
glob(os.path.join(MODULE, self.path)) +
glob(os.path.join(MODULE, "..", "wordnet", self.path)))[0]
except IndexError:
raise ImportError, "can't find SentiWordnet data file"
return f
A quick search reveals that load() is the only place where _path is referenced.
I don't want to be stepping on anyone's toes or overstepping by bounds by pointing this out, but it does seem like load() has a typo. When '_path' in load() is changed to 'path', everything behaves as expected.
The text was updated successfully, but these errors were encountered:
When the load function in pattern.text.en.parser.sentiment is given an optional path, it sets the '_path' attribute of the Lexicon object, whereas in all other locations the 'path' attribute (without the underscore) is referenced. If the underscore is removed from load, everything works as expected. I posted a more detailed explanation to a relevant google groups thread, which should hopefully be approved soon.
Here is the load function:
def load(self, path=None):
# Backwards compatibility with pattern.en.wordnet.Sentiment.
if path is not None:
self._path = path
self._parse()
Here is where the path attribute is intended to be used, in SentiWordNet._parse_path:
def _parse_path(self):
""" For backwards compatibility, look for SentiWordNet*.txt in:
pattern/en/parser/, patter/en/wordnet/, or the given path.
"""
try: f = (
glob(os.path.join(self.path)) +
glob(os.path.join(MODULE, self.path)) +
glob(os.path.join(MODULE, "..", "wordnet", self.path)))[0]
except IndexError:
raise ImportError, "can't find SentiWordnet data file"
return f
A quick search reveals that load() is the only place where _path is referenced.
I don't want to be stepping on anyone's toes or overstepping by bounds by pointing this out, but it does seem like load() has a typo. When '_path' in load() is changed to 'path', everything behaves as expected.
The text was updated successfully, but these errors were encountered: