public static String getSummary(String document, int max_length, String sentence_separator)
    {
        List<String> sentenceList = splitSentence(document, sentence_separator);

        int sentence_count = sentenceList.size();
        int document_length = document.length();
        int sentence_length_avg = document_length / sentence_count;
        int size = max_length / sentence_length_avg + 1;
        List<List<String>> docs = convertSentenceListToDocument(sentenceList);
        TextRankSentence textRank = new TextRankSentence(docs);
        int[] topSentence = textRank.getTopSentence(size);
        List<String> resultList = new LinkedList<String>();
        for (int i : topSentence)
        {
            resultList.add(sentenceList.get(i));
        }

        resultList = permutation(resultList, sentenceList);
        resultList = pick_sentences(resultList, max_length);
        return TextUtility.join("。", resultList);
    }
public static String getSummary ( String document , int max_length , String sentence_separator ) { List < String > sentenceList = splitSentence ( document , sentence_separator ) ; int sentence_count = sentenceList . size ( ) ; int document_length = document . length ( ) ; int sentence_length_avg = document_length / sentence_count ; int size = max_length / sentence_length_avg + 1 ; List < List < String > > docs = convertSentenceListToDocument ( sentenceList ) ; TextRankSentence textRank = new TextRankSentence ( docs ) ; int [ ] topSentence = textRank . getTopSentence ( size ) ; List < String > resultList = new LinkedList < String > ( ) ; for ( int i : topSentence ) { resultList . add ( sentenceList . get ( i ) ) ; } resultList = permutation ( resultList , sentenceList ) ; resultList = pick_sentences ( resultList , max_length ) ; return TextUtility . join ( "。" , resultList ) ; }
一句话调用接口

@param document   目标文档
@param max_length 需要摘要的长度
@param sentence_separator 句子分隔符，正则格式， 如：[。？?！!；;]
@return 摘要文本