Huawei Could API Artificial Intelligence Series - Entity Link
Preface
In the cloud native era, developers' programming methods and programming habits have undergone earth-shaking changes, and everyone is gradually getting used to building their own applications in the cloud. As a new generation of developers, how to understand the cloud more quickly, learn the cloud, use the cloud, develop code more conveniently and intelligently, thereby improving our development efficiency, is one of the hottest topics at present, and Huawei Cloud Toolkit, As a treasure chest connected to Huawei Cloud, it is a collection of plug-ins integrated on major IDE platforms, which will improve developer efficiency in all aspects.
The Huawei Cloud API Development Kit helps developers quickly integrate Huawei Cloud. It can easily connect to 200+ Huawei Cloud services, reference 7,000+ Huawei Cloud API services, and integrate Huawei Cloud functions in the IDE, allowing developers to communicate with Huawei Cloud in the cloud. establish connection.
In terms of intelligent coding, it integrates the large code model and software analysis technology independently developed by Huawei Cloud. It generates full-scenario function-level and line-level code, and ranks first in the industry in terms of computing power at the same scale. This will help developers use automatic semantics more efficiently. Generate to achieve rapid development and make the entire process smarter.
Environmental preparation
Development language: Python
Development tools: PyCharm Community Edition 2023.1.4
PyCharm plugin:
1. Chinese (Simplified) Language Pack/Chinese Language Pack
2. Huawei Cloud API: Huawei Cloud API plug-in provides Huawei Cloud service full API retrieval, debugging, SDK code automatic completion, integration of Huawei Cloud CLI, sample code and other functions
3. Huawei Cloud CodeArts Check: Huawei Cloud CodeArts Check plug-in provides industry standard (including Huawei Cloud) inspection, supports one-click formatting and automatic code repair, currently supports Java, C++, and C. This allows you to operate in the environment you are using. The python I use here has no prompts.
4. Huawei Cloud CodeArts Snap: Huawei Cloud CodeArt Snap intelligent programming assistant is committed to creating a new paradigm of modern development. By converting natural language into a standardized and readable programming language without open source vulnerabilities, it improves developer coding efficiency and helps enterprises quickly respond to the market. Uncertainty;
5. Huawei Cloud Toolkit Platform: Huawei Cloud base plug-in provides public capabilities for various Huawei Cloud cloud service plug-ins, such as single sign-on, UI integration, API access and other functions;
Construction of PyCharm environment: https://laoshifu.blog.csdn.net/article/details/135279145
API interface activation address: https://console.huaweicloud.com/nlp/#/nlp/overview
entity link
Perform entity link analysis on text in general fields, identify the entities in it, and return entity-related information.
Activation address: https://console.huaweicloud.com/nlp/#/nlp/overview
Activation effect:
Request parameters
name | type | IN | required | describe |
---|---|---|---|---|
X-Auth-Token | string | header | true | User Token. Obtain the user Token interface by calling the IAM service (the value of X-Subject-Token in the response message header). |
project_id | string | path | true | Project ID from public cloud for resource isolation. |
Body parameters
name | type | required | describe |
---|---|---|---|
text | string | true | The length of the text to be analyzed is 1~50, and the text encoding is UTF-8. |
lang | string | false | The supported text language type currently only supports Chinese, and the default is zh. |
Return parameters
name | type | required | describe |
---|---|---|---|
mention | string | true | entity reference |
offset | integer | true | Offset |
entity_title | string | true | Entity name |
API debugging
Test text: [Jay Chou held his nunchucks, struck his dragon fist, and walked towards Qilixiang with a secret that could not be told. 】
Return results:
{
"entities": [
{
"mention": "周杰伦",
"offset": 0,
"entity_title": "周杰伦"
},
{
"mention": "双节棍",
"offset": 7,
"entity_title": "双节棍(一种短兵器)"
},
{
"mention": "七里香",
"offset": 20,
"entity_title": "七里香(席慕容诗集)"
},
{
"mention": "不能说的秘密",
"offset": 25,
"entity_title": "不能说的秘密(2007年周杰伦自编自导电影)"
}
]
}
The split is more detailed, and it looks like the results are returned using a vector database.
local test
Copy the code and enter AK/SK.
After testing, this function is still very good. It can take out all physical things and can be used as some mall-type products.