How can repeat imports derive the same ID from a corpus name?
UUIDv5 derives a deterministic identifier from a namespace UUID and name, giving repeatable IDs for the same pair.
Python example and interpretation
Names differing only in case normally produce different identifiers. Establish the normalization rule first. A derived ID alone does not authenticate the source.
import uuid
ns=uuid.NAMESPACE_URL
[uuid.uuid5(ns,'corpus/A')==uuid.uuid5(ns,'corpus/A'),uuid.uuid5(ns,'corpus/A')==uuid.uuid5(ns,'corpus/a')]Result [True, False]
中文
如何让同一语料名称在重复导入时得到相同标识?
UUIDv5 根据命名空间 UUID 与名称派生确定性标识,同一输入组合产生同一 UUID。
Python 算例与适用条件
同一命名空间内,大小写不同的语料名通常得到不同标识。先约定名称规范;派生标识并不证明资料来源真实。
import uuid
ns=uuid.NAMESPACE_URL
[uuid.uuid5(ns,'corpus/A')==uuid.uuid5(ns,'corpus/A'),uuid.uuid5(ns,'corpus/A')==uuid.uuid5(ns,'corpus/a')]结果 [True, False]