agentsclimarketplace

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

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt4_8_GLM4.7/基于字符占比的混合文本语言识别

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

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill 基于字符占比的混合文本语言识别

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

1.9 KB, 496 tokens by cl100k_base, as published. Nobody here has run it

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

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

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

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

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.