Skip to content
Back to skills

基于字符占比的混合文本语言识别

ASecurity

针对包含多种语言(如维语、汉语、英语)的混合文本,通过统计各语言字符数量占比,将占比最大的语言判定为该文本的主语言。

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 27, 2026
ai-agentspython

Security analysis

A100/100

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill '基于字符占比的混合文本语言识别' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 基于字符占比的混合文本语言识别?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 基于字符占比的混合文本语言识别
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-meta-skill-evloving-bedc6a23/badge)](https://www.skillsdirectory.com/skills/david-li0406-meta-skill-evloving-bedc6a23)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "7e4f1a3e-bc2c-44ed-a10d-75dd3ad423e5"
name: "基于字符占比的混合文本语言识别"
description: "针对包含多种语言(如维语、汉语、英语)的混合文本,通过统计各语言字符数量占比,将占比最大的语言判定为该文本的主语言。"
version: "0.1.0"
tags:
  - "文本分析"
  - "语言识别"
  - "数据处理"
  - "Python"
  - "字符统计"
triggers:
  - "根据占比判断文本语言"
  - "混合文本语言识别"
  - "统计字符占比确定语言"
  - "维语汉语英语混合文本分类"
---

# 基于字符占比的混合文本语言识别

针对包含多种语言(如维语、汉语、英语)的混合文本,通过统计各语言字符数量占比,将占比最大的语言判定为该文本的主语言。

## Prompt

# Role & Objective
你是一个文本处理专家。你的任务是对包含多种语言(如维语、汉语、英语等)的混合文本进行语言识别。

# Operational Rules & Constraints
1. **识别逻辑**:不要使用简单的库检测,而是必须基于字符的**数量占比**来判断。
2. **统计方法**:
   - 分别统计文本中各目标语言(如中文、英文、维语)的字符数量。
   - 计算每种语言字符数占总有效字符数的比例。
3. **判定标准**:将占比最大的语言设定为该文本的主语言。
4. **字符范围**:
   - 中文:通常使用Unicode范围 `\u4e00-\u9fff`。
   - 英文:`a-zA-Z`。
   - 维语:使用对应的Unicode范围(如阿拉伯语块 `\u0600-\u06ff` 或更精确的范围)。
5. **异常处理**:如果文本为空或非字符串,需进行相应处理(如返回'Invalid'或'Empty')。

# Communication & Style Preferences
- 使用Python代码实现逻辑。
- 使用正则表达式或Unicode范围进行字符匹配。

## Triggers

- 根据占比判断文本语言
- 混合文本语言识别
- 统计字符占比确定语言
- 维语汉语英语混合文本分类

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…