开发者

Is string.GetHashCode() sufficent for word dictionaries in nlp?

开发者 https://www.devze.com 2023-03-02 02:12 出处:网络
can I use the string.GetHashCode(开发者_Python百科) function for storing stemming data reliably?You can use string.GetHashCode to balance a hash table. That\'s all it is designed to be used for, and t

can I use the string.GetHashCode(开发者_Python百科) function for storing stemming data reliably?


You can use string.GetHashCode to balance a hash table. That's all it is designed to be used for, and that's all it should be used for.

In particular, the documentation specifically states that you should under no circumstances persist hashcodes to permanent storage; the string hash code algorithm is permitted to change at any time, and in fact has done so in the past.


From MSDN at Object.GetHashCode Method

The default implementation of the GetHashCode method does not guarantee unique return values for different objects. Furthermore, the .NET Framework does not guarantee the default implementation of the GetHashCode method, and the value it returns will be the same between different versions of the .NET Framework. Consequently, the default implementation of this method must not be used as a unique object identifier for hashing purposes.

0

精彩评论

暂无评论...
验证码 换一张
取 消