Java文字摘要 [英] Java text summarization
问题描述
我正在为最新的应用程序编写文本汇总算法,并将代码从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屋!