如何知道 Wiki 页面是否适合某个人
How to know if a Wiki page is for a person
我使用 Wiki API 在 Wiki 页面上搜索一个词。我想知道这个词是不是一个人的名字。
例如搜索 "Leonardo Dicaprio"
https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=Leonardo%20Dicaprio&utf8=
我需要从查询结果中知道这是不是人名
您最好通过 Wikidata Query Service 和 Sparql 来完成此操作。
类似这样的方法可能有效:
SELECT DISTINCT ?person ?personLabel ?article WHERE {
?person wdt:P31 wd:Q5 .
?person rdfs:label ?personLabel .
FILTER( LANG(?personLabel) = "en")
FILTER( CONTAINS(LCASE(?personLabel), "leonardo dicaprio") ) .
?article schema:about ?person .
?article schema:isPartOf <https://en.wikipedia.org/> .
}
LIMIT 10
(如果超时,您可以添加更具体的搜索,例如 'country of citizenship':?person wdt:P27 wd:Q30
)
我使用 Wiki API 在 Wiki 页面上搜索一个词。我想知道这个词是不是一个人的名字。
例如搜索 "Leonardo Dicaprio"
https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=Leonardo%20Dicaprio&utf8=
我需要从查询结果中知道这是不是人名
您最好通过 Wikidata Query Service 和 Sparql 来完成此操作。
类似这样的方法可能有效:
SELECT DISTINCT ?person ?personLabel ?article WHERE {
?person wdt:P31 wd:Q5 .
?person rdfs:label ?personLabel .
FILTER( LANG(?personLabel) = "en")
FILTER( CONTAINS(LCASE(?personLabel), "leonardo dicaprio") ) .
?article schema:about ?person .
?article schema:isPartOf <https://en.wikipedia.org/> .
}
LIMIT 10
(如果超时,您可以添加更具体的搜索,例如 'country of citizenship':?person wdt:P27 wd:Q30
)