Skip to content

Commit f549ad8

Browse files
committed
update
1 parent c9c06c5 commit f549ad8

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

knowledgegraph.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1+
'''
2+
* Copyright (C) 2017 OwnThink Technologies Inc.
3+
*
4+
* Name : knowledgegraph.py - 知识图谱
5+
* Author : Yener <yener@ownthink.com>
6+
* Version : 0.01
7+
* Description : 知识图谱api请求示范
8+
'''
19
import requests
210

311
def mention2entity(mention):
412
'''
5-
提及->实体,根据提及获取歧义关系
13+
* mention2entity - 提及->实体
14+
* @mention: [in]提及
15+
* 根据提及获取歧义关系
616
'''
717
url = 'https://api.ownthink.com/kg/ambiguous?mention={mention}'.format(mention=mention) # 知识图谱API,歧义关系
818
sess = requests.get(url) # 请求
@@ -12,7 +22,9 @@ def mention2entity(mention):
1222

1323
def entity2knowledge(entity):
1424
'''
15-
实体->知识,根据实体获取实体知识
25+
* entity2knowledge - 实体->知识
26+
* @entity: [in]实体名
27+
* 根据实体获取实体知识
1628
'''
1729
url = 'https://api.ownthink.com/kg/knowledge?entity={entity}'.format(entity=entity) # 知识图谱API,实体知识
1830
sess = requests.get(url) # 请求
@@ -22,7 +34,10 @@ def entity2knowledge(entity):
2234

2335
def entity_attribute2value(entity, attribute):
2436
'''
25-
实体&属性->属性值,根据实体、属性获取属性值
37+
* entity_attribute2value - 实体&属性->属性值
38+
* @entity: [in]实体名
39+
* @attribute: [in]属性名
40+
* 根据实体、属性获取属性值
2641
'''
2742
url = 'https://api.ownthink.com/kg/eav?entity={entity}&attribute={attribute}'.format(entity=entity, attribute=attribute) # 知识图谱API,属性值
2843
sess = requests.get(url) # 请求

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy