首页 › API 文档 › 实用工具

文本统计分析(本地版)

对文本进行全面统计分析,包括字数、词频、标点符号、段落、句子等维度,支持中英文混合文本

接口地址

GET, POST https://api.tinyaii.cn/v1/text/analyze

分类:实用工具 · 返回格式:JSON · 鉴权:API Key(URL 参数 apikey 或请求头 Authorization: Bearer)

请求参数

参数名类型必填说明
textstring是待分析的文本内容

返回字段

字段名类型说明
characters.totalint总字符数
characters.bytesint总字节数
characters.chineseint中文字符数
characters.englishint英文字母数
characters.digitsint数字个数
characters.spacesint空格数
words.totalint总词数(中文按字+英文按词)
sentences.countint句子数
sentences.avg_lengthint平均句长
sentences.longeststring最长句子
sentences.shorteststring最短句子
paragraphs.countint段落数
paragraphs.linesint总行数
punctuation.totalint标点符号总数
punctuation.chineseint中文标点数
punctuation.englishint英文标点数
punctuation.toparray高频标点Top15
reading.estimated_minutesint预计阅读时间(分钟)
top_wordsarray高频词语Top10

返回示例

{
  "code": 200,
  "message": "success",
  "data": {
    "characters": {
      "total": 88,
      "bytes": 238,
      "chinese": 64,
      "english": 10,
      "digits": 3,
      "spaces": 0,
      "other": 0
    },
    "words": {
      "total": 66,
      "chinese_words": 64,
      "english_words": 2
    },
    "sentences": {
      "count": 6,
      "avg_length": 11,
      "longest": "TinyAPI提供免费的API接口服务,已经运行了200多天。",
      "shortest": "外面的阳光很好。"
    },
    "paragraphs": {
      "count": 1,
      "lines": 1,
      "blank_lines": 0
    },
    "punctuation": {
      "total": 11,
      "chinese": 11,
      "english": 0,
      "top": [
        {
          "punctuation": ",",
          "count": 4
        },
        {
          "punctuation": "。",
          "count": 4
        },
        {
          "punctuation": "!",
          "count": 2
        },
        {
          "punctuation": ":",
          "count": 1
        }
      ]
    },
    "reading": {
      "estimated_minutes": 1
    },
    "top_words": [
      {
        "word": "天",
        "count": 3
      },
      {
        "word": "走",
        "count": 2
      },
      {
        "word": "接口",
        "count": 1
      },
      {
        "word": "运行",
        "count": 1
      },
      {
        "word": "免费",
        "count": 1
      }
    ]
  }
}

调用示例

curl "https://api.tinyaii.cn/v1/text/analyze?apikey=YOUR_KEY&text=今天天气不错,我们出去走走吧!"

把 YOUR_KEY 换成你在 用户中心 获取的 API Key,在浏览器打开同样地址也能直接看到结果。

相关接口(实用工具)

本站收录 353 个可免费调用的 API 接口,查看完整开发文档 或 注册获取 API Key。