Java文字摘要 [英] Java text summarization

查看:409
本文介绍了Java文字摘要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为最新的应用程序编写文本汇总算法,并将代码从python转换为java.我被困在最后一刻很艰难.在python中,他们根据句子的分数对句子进行排序,并将其反转.

代码:

I am making a text summarization algorithm for my latest app and I am converting the code from python to java. I am stuck on the last part tough. in python they sort the sentences based on the score of the sentences and reverse it.

Code:

sentences.sort(key=lambda s: sentence_score(s, frequencies), reverse=1)



在Java中,我有句子数组和句子的分数.我需要对这样的句子进行排序.sort(sentencesScore,降序),但我真的不知道该怎么做.

感谢您提供任何帮助,谢谢



In java I have the sentences array and the score from the sentences. I need to sort the sentences like this .sort(sentencesScore, descending) but I dont really know how to.

Any help would be much appreciated, thanks

推荐答案

请参阅

报价:

Collections.sort(list,Collections.reverseOrder());

Collections.sort(list, Collections.reverseOrder());







or

CustomComparator


报价:

Collections.sort(list,Collections.reverseOrder(new CustomComparator());

Collections.sort(list, Collections.reverseOrder(new CustomComparator());


这篇关于Java文字摘要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆