2024-10-04 07:32:42 发布
网友
("horses are too tall and they pretend to care about your feelings", { 'entities': [(0, 6, 'ANIMAL')] })
我看到了这个数据结构。它是一个元组,第二个元素作为字典条目:
'entities': [(0,6, 'ANIMAL')]
我的问题是,为什么需要[]而不是更简单的形式:
'entities': (0,6, 'ANIMAL')
从单词entities的复数形式来看,很明显,数据结构的作者希望这个键是一个列表,很可能是为了将句子中的某些单词识别为已知的实体,因此可以有,例如:
entities
("Joe loves dogs", { 'entities': [(0, 3, 'PERSON'), (10, 14, 'ANIMAL')] })
表示索引0到3中的字符表示人,索引10到14中的字符表示动物。你知道吗
0
3
10
14
从单词
entities
的复数形式来看,很明显,数据结构的作者希望这个键是一个列表,很可能是为了将句子中的某些单词识别为已知的实体,因此可以有,例如:表示索引
0
到3
中的字符表示人,索引10
到14
中的字符表示动物。你知道吗相关问题 更多 >
编程相关推荐