主题
content_generation/text_summary/live
GET /v3/appendix/errors
#生成:文本摘要实时接口
POST /v3/content_generation/text_summary/live
本接口对提交的文本进行统计与可读性分析,返回句子数、段落数、词数、字符数、词汇密度、密度、可读性指数,以及拼写和语法错误数量等数据。
每次请求均会计费,参考价约 ¥0.0072 / 次。扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
所有 POST 请求须使用 UTF-8 编码的 JSON 格式提交,请求体为 JSON 数组 [{ ... }]。平台限流以认证说明中的 30/60/120 次/分钟规则为准。
请求参数
| 字段名 | 类型 | 填 | 说明 |
|---|---|---|---|
text | string | 是 | 分析文本,长度为 1 至 10000 个 token。 |
language_name | string | 条件填 | 文本语言名称;未提供 language_code 时提供。可通过 GET /v3/content_generation/text_summary/languages 查询支持的语言列表。 |
language_code | string | 条件填 | 文本语言代码;未提供 language_name 时提供。可通过 GET /v3/content_generation/text_summary/languages 查询支持的语言列表。 |
internal_list_limit | integer | 否 | 部数组中返回的最大数量,用于限制 keyword_density 中的数量。默认值:10。 |
tag | string | 否 | 自定义任务标识,最长 255 个字符。可用于将请求与响应结果;该值会在响应的 data 对象中原样返回。 |
请求示例
curl
bash
curl --location --request POST "https://api.seermartech.cn/v3/content_generation/text_summary/live" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data-raw '[
{
"text": "Removing RequireHttps does nothing but break HTTPS redirection. I have one method exposed over HTTP and another exposed over HTTPS. When a user enters an HTTP URL for the HTTPS-only method, the request should redirect to HTTPS.",
"language_name": "English (United States)",
"internal_list_limit": 10,
"tag": "article-readability-check-001"
}
]'Python
python
import requests
url = "https://api.seermartech.cn/v3/content_generation/text_summary/live"
# 请求体为 JSON 数组
payload = [
{
"text": (
"Removing RequireHttps does nothing but break HTTPS redirection. "
"I have one method exposed over HTTP and another exposed over HTTPS. "
"When a user enters an HTTP URL for the HTTPS-only method, "
"the request should redirect to HTTPS."
),
"language_name": "English (United States)",
"internal_list_limit": 10,
"tag": "article-readability-check-001"
}
]
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers, timeout=30)
result = response.json()
if result["status_code"] == 20000:
print(result["tasks"][0]["result"])
else:
print(
f'请求失败:{result["status_code"]} - '
f'{result["status_message"]}'
)TypeScript
typescript
import axios from "axios";
const url = "https://api.seermartech.cn/v3/content_generation/text_summary/live";
// 请求体为 JSON 数组
const payload = [
{
text: "Removing RequireHttps does nothing but break HTTPS redirection. I have one method exposed over HTTP and another exposed over HTTPS. When a user enters an HTTP URL for the HTTPS-only method, the request should redirect to HTTPS.",
language_name: "English (United States)",
internal_list_limit: 10,
tag: "article-readability-check-001"
}
];
async function getTextSummary() {
try {
const response = await axios.post(url, payload, {
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
});
const result = response.data;
if (result.status_code === 20000) {
console.log(result.tasks[0].result);
} else {
console.error(`请求失败:${result.status_code} - ${result.status_message}`);
}
} catch (error) {
console.error("请求异常:", error);
}
}
getTextSummary();响应结构
接口返回 JSON 对象 tasks 数组各个提交任务的处理结果。
顶层字段
| 字段名 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 局状态码。20000 通常表示请求成功;状态码请结合错误码说明处理。 |
status_message | string | 局状态信息。 |
time | string | 请求总执行时间,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
tasks_count | integer | tasks 数组中的任务总数。 |
tasks_error | integer | tasks 数组中处理失败的任务数量。 |
tasks | array | 任务结果数组。 |
tasks 任务字段
| 字段名 | 类型 | 说明 |
|---|---|---|
id | string | 平台生成的唯一任务 ID,采用 UUID 格式。 |
status_code | integer | 任务状态码,通常在 10000 至 60000 范围。 |
status_message | string | 任务状态说明。 |
time | string | 单个任务执行时间,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
result_count | integer | result 数组中的结果数量。 |
path | array | 当前任务对应的 API 路径组成部分。 |
data | object | 请求中提交的参数 text、语言参数及自定义 tag。 |
result | array | 文本分析结果数组。 |
result 文本统计字段
| 字段名 | 类型 | 说明 |
|---|---|---|
sentences | integer | 文本中识别到的句子数量。 |
paragraphs | integer | 文本中识别到的段落数量。 |
words | integer | 文本中的词数。 |
characters_without_spaces | integer | 不含空格的字符数。 |
characters_with_spaces | integer | 含空格的字符数。 |
words_per_sentence | float | 平均每句词数。 |
characters_per_word | float | 平均每个词的字符数。 |
vocabulary_density | float | 词汇密度。 |
keyword_density | object | 高频词及出现次数。返回数量由 internal_list_limit 控制。 |
automated_readability_index | float | 自动可读性指数(ARI)。 |
coleman_liau_index | float | Coleman-Liau 可读性指数。 |
flesch_kincaid_grade_level | float | Flesch-Kincaid 年级可读性指数。 |
smog_readability_index | float | SMOG 可读性指数。 |
spelling_errors | integer | 检测到的拼写错误数量。 |
grammar_errors | integer | 检测到的语法错误数量。 |
响应示例
json
{
"version": "0.1.20221214",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.9516 sec.",
"cost": 0.001,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "01061611-1535-0507-0000-17ffb2141dd8",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.8954 sec.",
"cost": 0.001,
"result_count": 1,
"path": [
"v3",
"content_generation",
"text_summary",
"live"
],
"data": {
"api": "content_generation",
"function": "text_summary",
"text": "Removing RequireHttps does nothing but break HTTPS redirection.",
"language_name": "English (United States)",
"tag": "article-readability-check-001"
},
"result": [
{
"sentences": 5,
"paragraphs": 1,
"words": 82,
"characters_without_spaces": 373,
"characters_with_spaces": 453,
"words_per_sentence": 16.4,
"characters_per_word": 4.390243902439025,
"vocabulary_density": 0.7317073170731707,
"keyword_density": {
"the": 4,
"https": 4,
"is": 4,
"to": 3,
"and": 2
},
"automated_readability_index": 7.448048780487806,
"coleman_liau_index": 8.209756097560977,
"flesch_kincaid_grade_level": 105.26100000000002,
"smog_readability_index": 3.1291,
"spelling_errors": 11,
"grammar_errors": 14
}
]
}
]
}状态码与错误处理
- 当顶层
status_code为20000,且任务status_code为20000时,表示任务已成功完成。 - 请求成功不代表每个任务均成功,应同时检查
tasks_error和每个tasks[].status_code。 - 建议在业务系统中针对认证失败、参数校验失败、限流、服务端异常及任务级错误实现重试、告警或降级处理。
- 可参考
GET /v3/appendix/errors获取完整状态码与错误信息说明。
实用场景
- 评估文章可读性:在发布前检测句长、词长和多项可读性指数,帮助编辑调整表达难度以匹目标读。
- 筛查拼写与语法问题:批量分析商品描述、落地页文案或博客草稿中的错误数量,降低低质量上线风险。
- 识别重心:通过
keyword_density提取高频词,验证页面是否围绕目标主题和核心查询词展开。 - 监控竞品结构:统计竞品页面的段落、句子和词数,制定更符合搜索意图的篇与结构策略。
- 建立质量评分模型:将词汇密度、可读性、错误数等指标接 CMS 审核流程,为 SEO提供自动化质量门槛。