java英文小说词频统计_【用JAVA语言设计一个类,统计一篇英文文章的词频,并按照词频由高到低输出.修改下面代码就行了.publicclassArticle{//保存文章的内容Stringconte...

用JAVA语言设计一个类,统计一篇英文文章的词频,并按照词频由高到低输出.修改下面代码就行了.

public class Article {

//保存文章的内容

String content;

//保存分割后的单词集合

String[] rawWords;

//保存统计后的单词集合

String[] words;

//保存单词对应的词频

int[] wordFreqs;

//构造函数,输入文章内容

//提高部分:从文件中读取

public Article()

{

content="kolya is one of the richest films i've seen in some time .zdenek sverak plays a confirmed old bachelor ( who's likely to remain so ) ,who finds his life as a czech cellist increasingly impacted by the five-year old boy that he's taking care of .though it ends rather abruptly-- and i'm whining ,'cause i wanted to spend more time with these characters-- the acting ,writing ,and production values are as high as ,if not higher than ,comparable american dramas .this father-and-son delight-- sverak also wrote the script ,while his son ,jan ,directed-- won a golden globe for best foreign language film and ,a couple days after i saw it ,walked away an oscar .in czech and russian ,with english subtitles .";

}

//对文章根据分隔符进行分词,将结果保存到rawWords数组中

public void splitWord()

{

}

//统计词,遍历数组

public void countWordFreq()

{

}

//根据词频,将词数组和词频数组进行降序排序

public void sort()

{

}

//将排序结果输出

public void printResult()

{

}

public static void main(String[] args)

{

//测试类的功能

}

}

(2)在上面的基础上完成从文件夹中读取所有文章,输出每篇文章词频最高的10个词.

作业帮用户2017-09-27举报

6c0a0adef10d1043fa4f41a7897345ed.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值