An open API service indexing awesome lists of open source software.

https://github.com/anycodes/ai-keywords

基于 TF-IDF 与 Textrank 的中文文本关键词提取应用
https://github.com/anycodes/ai-keywords

Last synced: 3 months ago
JSON representation

基于 TF-IDF 与 Textrank 的中文文本关键词提取应用

Awesome Lists containing this project

README

          

# AI-Keywords 帮助文档











> ***基于 TF-IDF 与 Testrank 的中文关键词提取应用***

## 前期准备
使用该项目,推荐您拥有以下的产品权限 / 策略:

| 产品/服务 | 函数计算 | 对象存储 |
| ---- | ---- | ---- |
| 权限/策略 | AliyunFCFullAccess
AliyunACRFullAccess | AliyunOSSFullAccess |

## 代码 & 预览

- [😼 源代码](https://github.com/anycodes/ai-keywords)
- [👀 项目预览](http://ai-keywords.start-ai.1767215449378635.cn-chengdu.fc.devsapp.net/)

## 部署 & 体验

- **途径1**:🔥 通过 [Serverless 应用中心](https://fcnext.console.aliyun.com/applications/create?template=start-express) ,
[![Deploy with Severless Devs](https://img.alicdn.com/imgextra/i1/O1CN01w5RFbX1v45s8TIXPz_!!6000000006118-55-tps-95-28.svg)](https://fcnext.console.aliyun.com/applications/create?template=start-express) 该应用。

- **途径2**:通过[ CloudShell 在线体验部署](https://api.aliyun.com/new#/tutorial?action=git_open&git_repo=https://github.com/devsapp/start-web-framework.git&tutorial=web-framework/nodejs/custom-runtime/express/cloudshell.md)

- **途径3**:通过 [Serverless Devs Cli](https://www.serverless-devs.com/serverless-devs/install) 进行部署:
- [安装 Serverless Devs Cli 开发者工具](https://www.serverless-devs.com/serverless-devs/install),并进行[授权信息配置](https://www.serverless-devs.com/fc/config);
- 初始化项目:`s init start-express -d start-express`
- 进入项目,并进行项目部署:`cd start-express && s deploy -y`

## 应用详情

本应用是基于 Serverless 架构实现,通过 TF-IDF 算法以及 Textrank 算法,可以实现中文文本关键词提取功能。

应用完成部署,可以通过默认页面进行测试体验:

![图片alt](https://serverless-article-picture.oss-cn-hangzhou.aliyuncs.com/1650614926448_20220422080846773303.png)

可以根据返回的地址信息,进行使用:

- URI: `/ai-kyewords`
- Method: `POST`
- 参数信息:
- Headers:
- `Content-type`: `application/json`
- Body:
- `text`: 要提取关键词的文本, 必填
- `count`: 关键词个数, 选填,默认`5`
- `type`: 提取算法类型,取值范围[`tfidf`, `textrank`], 选填,默认`tfidf`
- 测试代码(Python):
```python
import requests
import base64
def getResult(content, count, wtype):
data = json.dumps({"text": content, "count": count, "type": wtype})
txt = requests.post("http://ai-keywords.start-ai.1767215449378635.cn-chengdu.fc.devsapp.net/keywords", data=data,
headers={'Content-Type': 'application/json'})
return txt.content.decode("utf-8")
print(getResult("文本", 5, "tfidf"))
```

## 开发者社区

您如果有关于错误的反馈或者未来的期待,您可以在 [Serverless Devs repo Issues](https://github.com/serverless-devs/serverless-devs/issues) 中进行反馈和交流。如果您想要加入我们的讨论组或者了解 FC 组件的最新动态,您可以通过以下渠道进行:

| | | |
|--- | --- | --- |
|

微信公众号:`serverless` | 微信小助手:`xiaojiangwh` | 钉钉交流群:`33947367` |