代码之家  ›  专栏  ›  技术社区  ›  moodymudskipper

从wikipedia/wikidata/linked data获取消除歧义的同音词列表

  •  6
  • moodymudskipper  · 技术社区  · 6 年前

    如果我搜索 "George Bush" 在维基百科上我会得到 this page 其中列出了同名词和简短的描述。

    • 乔治H。W。灌木
    • 乔治W。灌木
    • 乔治·布什(圣经学者)
    • 乔治·布什(足球运动员)
    • 乔治P。灌木

    我不介意得到更多,只要我能毫不含糊地解析它。

    1 回复  |  直到 6 年前
        1
  •  2
  •   Terence Eden    6 年前

    例如- https://en.wikipedia.org/w/api.php?action=query&titles=George%20Bush&prop=links -会告诉你是否有一个“消除歧义”的人的名字。

    将返回:

                   {
                        "ns": 0,
                        "title": "Bush family"
                    },
                    {
                        "ns": 0,
                        "title": "George Brush (disambiguation)"
                    },
                    {
                        "ns": 0,
                        "title": "George Bush (biblical scholar)"
                    },
                    {
                        "ns": 0,
                        "title": "George Bush (footballer)"
                    },
                    {
                        "ns": 0,
                        "title": "George Bush (racing driver)"
                    },
                    {
                        "ns": 0,
                        "title": "George H. W. Bush"
                    },
                    {
                        "ns": 0,
                        "title": "George P. Bush"
                    },
                    {
                        "ns": 0,
                        "title": "George W. Bush"
                    },
                    {
                        "ns": 0,
                        "title": "George Washington Bush"
    

    您可以使用- https://en.wikipedia.org/w/api.php?action=query&utf8=&list=search&srsearch=George%20Bush

    这会让你:

        "search": [
            {
                "ns": 0,
                "title": "George W. Bush",
                "pageid": 3414021,
                "size": 299185,
                "wordcount": 27007,
                "snippet": "<span class=\"searchmatch\">George</span> Walker <span class=\"searchmatch\">Bush</span> (born July 6, 1946) is an American politician who served as the 43rd President of the United States from 2001 to 2009. He had previously",
                "timestamp": "2018-09-26T21:48:08Z"
            },
            {
                "ns": 0,
                "title": "George H. W. Bush",
                "pageid": 11955,
                "size": 210189,
                "wordcount": 20867,
                "snippet": "<span class=\"searchmatch\">George</span> Herbert Walker <span class=\"searchmatch\">Bush</span> (born June 12, 1924) is an American politician who served as the 41st President of the United States from 1989 to 1993. Prior",
                "timestamp": "2018-10-01T06:41:50Z"
            },