mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-27 10:26:35 +03:00
Use spacy hash_string function instead of md5
This commit is contained in:
parent
c3d722d66f
commit
f4748834d9
|
@ -1,9 +1,9 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
from spacy.compat import intern, queue
|
from spacy.compat import intern, queue
|
||||||
|
from spacy.strings import hash_string
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
import re
|
import re
|
||||||
from hashlib import md5
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from .pattern import DependencyPattern
|
from .pattern import DependencyPattern
|
||||||
|
@ -294,8 +294,8 @@ class Token(tuple):
|
||||||
return tuple.__new__(cls, (lineno, intern(str(type)), value))
|
return tuple.__new__(cls, (lineno, intern(str(type)), value))
|
||||||
|
|
||||||
def hash(self):
|
def hash(self):
|
||||||
string = str(self.value)
|
string = self.value
|
||||||
return md5(string.encode('utf-8')).hexdigest()
|
return hash_string(string)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return 'Token(%r, %r, %r)' % (
|
return 'Token(%r, %r, %r)' % (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user