擷取連結的實體
在某些情況下,相同的名稱可能適用於一個以上的實體。 例如,"Venus" 一詞的實例是指行星,還是神話中的女神?
您可以參考知識庫中的文章,使用實體連結來區分相同名稱的實體。 維基百科提供適用於文字分析服務的知識庫。 特定文章連結是根據文字內的實體內容所決定。
例如,"I saw Venus shining in the sky" (我看到金星在天空中閃耀) 會與 https://en.wikipedia.org/wiki/Venus 連結相關聯;而 "Venus, the goddess of beauty" (維納斯,美麗之神) 則會與 https://en.wikipedia.org/wiki/Venus_(mythology) 相關聯。
如同所有語言服務功能,您可以提交一或多份文件來進行分析:
{
"documents": [
{
"language": "en",
"id": "1",
"text": "I saw Venus shining in the sky"
}
]
}
回應會包含文字中識別的實體,以及相關聯文章的連結:
{
"documents":
[
{
"id":"1",
"entities":[
{
"name":"Venus",
"matches":[
{
"text":"Venus",
"offset":6,
"length":5,
"confidenceScore":0.01
}
],
"language":"en",
"id":"Venus",
"url":"https://en.wikipedia.org/wiki/Venus",
"dataSource":"Wikipedia"
}
],
"warnings":[]
}
],
"errors":[],
"modelVersion":"2020-02-01"
}