mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
Add get, set and has methods to Underscore
This commit is contained in:
parent
51d18937af
commit
59c4f27499
|
@ -37,5 +37,14 @@ class Underscore(object):
|
|||
else:
|
||||
self._doc.user_data[self._get_key(name)] = value
|
||||
|
||||
def set(self, name, value):
|
||||
return self.__setattr__(name, value)
|
||||
|
||||
def get(self, name):
|
||||
return self.__getattr__(name)
|
||||
|
||||
def has(self, name):
|
||||
return name in self._extensions
|
||||
|
||||
def _get_key(self, name):
|
||||
return ('._.', name, self._start, self._end)
|
||||
|
|
Loading…
Reference in New Issue
Block a user