用Mathematica统计字母、字符和单词

 时间:2026-02-12 03:15:32

1、先给出字符串:

a = "If we give a paragraph of English text, we want to get the number of times each letter appears, we need to use the function: LetterCounts.This article introduces the usage of this function."

用Mathematica统计字母、字符和单词

2、统计字母频率:

LetterCounts[a]

出现次数最多的是字母e。

用Mathematica统计字母、字符和单词

3、出现次数最多的双字母是ti:

LetterCounts[a, 2]

用Mathematica统计字母、字符和单词

4、the是出现次数最多的三字母:

LetterCounts[a, 3]

用Mathematica统计字母、字符和单词

5、出现次数最多的字符是空格:

CharacterCounts[a]

用Mathematica统计字母、字符和单词

6、出现次数最多的双字符是"e ":

Reverse[Sort@CharacterCounts[a, 2]]

用Mathematica统计字母、字符和单词

7、出现次数最多的单词是we、of、the:

Reverse[Sort@WordCounts[a]]

用Mathematica统计字母、字符和单词

  • Mathematica列表使用小技巧
  • 蚂蚁森林能量双享卡是什么
  • 易语言颜色选择组件和组合框如何用
  • DOS工具箱MHDD扫硬盘查找硬盘故障
  • 逃脱本色第二章攻略
  • 热门搜索
    澳大利亚 旅游签证 丹东旅游团 第一步旅游 北京旅游年票网 苏州旅游财经学院 永定土楼旅游攻略 莆田旅游网 广东旅游网 珠海旅游攻略自由行 旅游活动主题