unstructured bug/parent_id 仍然是一个具有 unique_element_ids=True 的哈希,

nnt7mjpx  于 2个月前  发布在  其他
关注(0)|答案(2)|浏览(51)

使用0.11.8版本

>> part = partition(url=source, unique_element_ids=True)
>> part[5].id
'80aeff2c-f406-470e-b82e-512723f1bdd3'
>>> part[5].metadata.to_dict()['parent_id']
'11364a4c8f174651156e7203a53f4c1a'

这使得整个parent_id无法使用。

js81xvg6

js81xvg61#

我快速查看了一下代码,我认为最简单的修复方法是在元数据类中添加一个 _parent ,并创建一个 parent_id 属性来返回 _parent.id
然后在 unstructured/partition/common 中将 _parent 设置为 topelement

cgyqldqp

cgyqldqp2#

目前,我刚刚将https://github.com/Unstructured-IO/unstructured/blob/main/unstructured/documents/elements.py#L755处的has代码替换为下一个elif块的uuid代码,当然也禁用了unique_element_ids=True(因为这会重新生成id)。能够切换这种行为当然是个快速的技巧。

相关问题