亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? jphrase.java

?? AutoSummary uses Natural Language Processing to generate a contextually-relevant synopsis of plain t
?? JAVA
字號:
/*
 * This software is OSI Certified Open Source Software.
 * OSI Certified is a certification mark of the Open Source Initiative.
 *
 * This file is part of the AutoSummary package.
 * AutoSummary is licensed under the terms of the BSD License.
 *
 * Copyright (c) 2005, Charles F. Greenbacker III
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 *     * Redistributions of source code must retain the above copyright notice,
 *       this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright notice,
 *       this list of conditions and the following disclaimer in the documentation
 *       and/or other materials provided with the distribution.
 *     * Neither the name of AutoSummary nor the names of its contributors
 *       may be used to endorse or promote products derived from this software without
 *       specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
 * SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package net.artificialminds.AutoSummary;

import net.artificialminds.AutoSummary.FloatArrayComparator;
import net.artificialminds.JWords.JWord;
import net.artificialminds.JWords.JWords;
import net.artificialminds.JWords.JSense;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;

/**
 * Development platform for word sense disambigulation methods. It creates a JPhrase object
 * containing JWords representing all the words in a given phrase. Statistical analysis can
 * then be performed using the lexigraphical information stored in the JWords, which allows
 * a program to determine the likely usage of each individual word in the phrase.
 * <p>
 * Note: When compiled with a JDK that supports generics (such as JDK 1.5), you will receive
 * notice that JPhrase.java uses unchecked or unsafe operations. This complaint wants
 * the ArrayLists in the code to use generics, but doing so breaks compatibility with
 * older JDKs (J2SE 1.4.2 SDK, etc), so generics are not used.
 *
 * @author                  Charlie Greenbacker
 * @version                 0.1.0a 20050816
 * @since                   AutoSummary 0.1.0a
 */
public class JPhrase
{
    /**
     * Stores source phrase provided as input.
     */
    private String phrase = null;

    /**
     * Stores JWords representing words in the given phrase. JWords are constructed after breaking down
     * input phrase into individual words.
     */
    private ArrayList wordList = null;

    /**
     * Holds scores for each part-of-speech type for every word in phrase. Scores are obtained from the
     * POS scores from all of the JWords in wordList. The last column contains the sum of all scores for
     * each word.
     */
    private float[][] posScores = null;

    /**
     * Contains valid parts-of-speech for each word in the phrase. Rows will vary in size depending on number
     * of valid parts-of-speech for the corresponding word. Only parts-of-speech with a posScore greater than
     * zero are considered 'valid,' meaning the given word can possibly be used as a particular POS. Entries
     * are integers representing parts-of-speech in the format: 0=noun, 1=verb, 2=adj, 3=adv.
     */
    private int[][] validPOS = null;

    /**
     * Holds every valid combination all using possible POS types for each word. Each combo has an integer in place
     * of each word, corresponding to the part-of-speech used (0=noun, 1=verb, 2=adj, 3=adv). The last column
     * contains the sum of POS scores for the specific parts-of-speech used for each word in that particular combo.
     */
    private float[][] posCombos = null;

    /**
     * Sole constructor. Creates a JPhrase object containing lexigraphical information about the words in the
     * given phrase upon which semantic analysis will be performed.
     *
     * @param inputPhrase   the input phrase to be analyzed
     * @since               AutoSummary 0.1.0a
     */
    public JPhrase(String inputPhrase)
    {
        phrase = inputPhrase; // capture input phrase

        String[] wordArray = null; // temporary storage of words used to create JWords & wordList

        JWord myJWord = null; // JWord used to store WordNet lexical information

        // value (out of 100) representing average statistical likeliness of each word appearing as the given POS
        float confidence = 0;

        // chop phrase into individual words, construct JWords out of each and add to wordList
        wordArray = phrase.split(" ");
        wordList = new ArrayList();
        for (int i=0; i<wordArray.length; i++)
            wordList.add(new JWord(wordArray[i]));
        wordList.trimToSize();

        // create posScores and populate with all POS scores for each word in phrase
        posScores = new float[wordList.size()][];
        for (int i=0; i<posScores.length; i++)
        {
            myJWord = (JWord)wordList.get(i);
            posScores[i] = new float[4];
            posScores[i][0] = myJWord.getNounScore();
            posScores[i][1] = myJWord.getVerbScore();
            posScores[i][2] = myJWord.getAdjScore();
            posScores[i][3] = myJWord.getAdvScore();
        }

        // create array of valid parts of speech for each word by looping through phrase and only grabbing
        // parts of speech with non-zero POS scores (0 for a noun, 1 for a verb, 2 for adj, 3 for adv); the
        // number of elements in each row corresponds to the number of valid parts-of-speech of each word
        validPOS = new int[posScores.length][];
        int valids = 0; // keeps track of valid POSs
        int position = 0; // keeps track of position
        for (int i=0; i<posScores.length; i++)
        {
            for (int j=0; j<4; j++)
            {
                if (posScores[i][j] != 0)
                    valids++;
            }
            validPOS[i] = new int[valids];
            for (int j=0; j<4; j++)
            {
                if (posScores[i][j] != 0)
                {
                    validPOS[i][position] = j;
                    position++;
                }
            }
            valids = 0;
            position = 0;
        }

        // calculate the total number of possible combinations using only valid POSs of each word
        int validCombos = 1; // number of valid combos, start at 1 because we use multiplicative incrementation
        for (int i=0; i<validPOS.length; i++)
            validCombos *= validPOS[i].length;

        // create all possible combinations using input from validPOS; last element in each row stores cumulative
        // POS score, all others a number corresponding to POS (0 = n, 1 = v, 2 = adv, 3 = adj)
        posCombos = new float[validCombos][posScores.length + 1];
        // keeps track of "pattern" when creating combinations,
        // starts at zero because we use multiplicative incrementation
        int offset = 1;
        int combo = 0; // keeps track of current combo
        for (int i=0; i<validPOS.length; i++)
        {
            combo = 0;
            while (combo < validCombos) // use each "pattern" over & over until array is filled
            {
                for (int j=0; j<validPOS[i].length; j++)
                {
                    for (int k=0; k<offset; k++)
                    {
                        if (combo < validCombos)
                        {
                            posCombos[combo][i] = validPOS[i][j];
                            posCombos[combo][posScores.length] += posScores[i][validPOS[i][j]];
                            combo++;
                        }
                    }
                }
            }
            offset *= validPOS[i].length; // changes "pattern" for each word
        }

        // sort in descending order based on total POS score of each combo
        Comparator FAComp = new FloatArrayComparator();
        Arrays.sort(posCombos, FAComp);
    }

    /**
     * Retrieves original source phrase.
     *
     * @return          original source phrase
     * @since           AutoSummary 0.1.0a
     */
    public String getPhrase()
    {
        return phrase;
    }

    /**
     * Retrieves list of JWords representing words in the source phrase.
     *
     * @return          the list of JWords representing words in the source phrase
     * @since           AutoSummary 0.1.0a
     */
    public ArrayList getWordList()
    {
        return wordList;
    }

    /**
     * Retrieves scores for each part-of-speech type for every word in phrase.
     *
     * @return          the scores for each part-of-speech type for every word in phrase
     * @since           AutoSummary 0.1.0a
     */
    public float[][] getPOSScores()
    {
        return posScores;
    }

    /**
     * Retrieves valid parts-of-speech for each word in the phrase.
     *
     * @return          valid parts-of-speech for each word in the phrase
     * @since           AutoSummary 0.1.0a
     */
    public int[][] getValidPOS()
    {
        return validPOS;
    }

    /**
     * Retrieves every valid combination using all possible POS types for each word.
     *
     * @return          every valid combination using all possible POS types for each word
     * @since           AutoSummary 0.1.0a
     */
    public float[][] getPOSCombos()
    {
        return posCombos;
    }

    /**
     * Retrieves most likely combo based on overall POS scores. Output resembles original source
     * phrase, except with the suggested part-of-speech in parentheses after each word.
     *
     * @return          most likely combo; each word tagged with suggested part-of-speech
     * @since           AutoSummary 0.1.0a
     */
    public String posTagger()
    {
        String taggedPhrase = ""; // stores output
        // loop through all words in highest scoring combo, and append POS identified as 0, 1, 2 or 3
        for (int i=0; i<(posCombos[0].length - 1); i++)
        {
            taggedPhrase += ((JWord)wordList.get(i)).getWord();
            switch ((int)posCombos[0][i])
            {
                case 0:
                    taggedPhrase += "(n) ";
                    break;
                case 1:
                    taggedPhrase += "(v) ";
                    break;
                case 2:
                    taggedPhrase += "(adj) ";
                    break;
                case 3:
                    taggedPhrase += "(adv) ";
                    break;
            }
        }
        return taggedPhrase;
    }

    /**
     * Calculates and returns level of confidence of most likely combo (from posTagger()), based on
     * average relative POS score of each word in combo. Output is a float value (out of 100)
     * representing average statistical likeliness of each word appearing as the POS determined by
     * posTagger().
     *
     * @return          level of confidence, as a percentage
     * @since           AutoSummary 0.1.0a
     */
    public float getConfidence()
    {
        float confidence = 0; // stores output
        for (int i=0; i<posScores.length; i++)
            confidence += ((posScores[i][(int)posCombos[0][i]]/(posScores[i][0] + posScores[i][1] + posScores[i][2] + posScores[i][3])) * 100);
        confidence = confidence / posScores.length;
        return confidence;
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
伊人色综合久久天天人手人婷| 亚洲永久精品国产| 中文字幕一区二区三| 国产美女av一区二区三区| 国产盗摄视频一区二区三区| 91麻豆国产在线观看| 欧美一区二区视频免费观看| 中文字幕一区二区三| 黄色成人免费在线| 欧美人xxxx| 亚洲天堂中文字幕| 91在线国产观看| 欧美不卡一区二区三区四区| 日韩一区在线看| 国产大片一区二区| 日韩网站在线看片你懂的| 亚洲精品欧美综合四区| 丁香婷婷综合五月| 成人性生交大片| xfplay精品久久| 美女视频一区二区三区| 欧美日韩一区二区三区不卡| 亚洲男人的天堂一区二区| 国产成人精品免费| 久久亚洲综合色一区二区三区| 日韩精品91亚洲二区在线观看| 色网综合在线观看| 亚洲妇女屁股眼交7| 91视频在线看| 亚洲美女在线一区| 色综合久久久久综合体桃花网| 国产欧美日韩一区二区三区在线观看| 国内精品伊人久久久久av一坑| 欧美一区二视频| 奇米影视一区二区三区| 日韩一区二区三区av| 免费不卡在线观看| 欧美刺激脚交jootjob| 另类综合日韩欧美亚洲| 精品国产免费久久| 国产精品资源站在线| 欧美国产日韩一二三区| 波多野结衣在线aⅴ中文字幕不卡| 国产丝袜在线精品| 99免费精品在线| 亚洲国产一区二区a毛片| 欧美男女性生活在线直播观看| 午夜激情一区二区| 精品国产露脸精彩对白| 国产成人精品免费视频网站| 国产精品久久久久9999吃药| 91成人免费在线| 日本不卡一区二区三区| 精品成a人在线观看| 国产98色在线|日韩| 综合网在线视频| 制服视频三区第一页精品| 九九精品一区二区| 中文字幕在线一区免费| 欧美日韩高清在线播放| 久久国产成人午夜av影院| 亚洲国产高清在线观看视频| 日本乱人伦一区| 久久99精品国产.久久久久久| 欧美激情艳妇裸体舞| 91精彩视频在线| 久久久久国产精品免费免费搜索| 免费成人在线网站| 国产欧美日韩久久| 欧美日韩中文字幕精品| 国产suv精品一区二区883| 亚洲精品欧美激情| 日韩午夜在线影院| 99国产精品久久久久| 日韩中文字幕不卡| 成人欧美一区二区三区在线播放| 制服丝袜一区二区三区| 成人app软件下载大全免费| 亚洲高清视频在线| 中文字幕欧美国产| 欧美肥妇毛茸茸| eeuss国产一区二区三区| 免费精品视频在线| 亚洲一区二区在线免费观看视频 | 免费观看91视频大全| 国产欧美一区二区精品性| 在线观看91视频| 成人网页在线观看| 麻豆精品视频在线| 婷婷开心激情综合| 一区二区三区在线影院| 中文字幕免费观看一区| 日韩欧美在线一区二区三区| 91福利在线观看| 成人av在线一区二区三区| 久久99日本精品| 亚洲国产另类精品专区| 亚洲欧美国产毛片在线| 欧美韩国日本综合| 国产网站一区二区| 久久亚洲二区三区| 日韩片之四级片| 欧美一区午夜精品| 91精品在线观看入口| 欧美性生交片4| 色8久久精品久久久久久蜜| 99久久久精品| 99re成人精品视频| caoporm超碰国产精品| 丁香婷婷深情五月亚洲| 国产精品一区一区| 国产精一品亚洲二区在线视频| 日韩电影在线免费观看| 午夜亚洲国产au精品一区二区| 亚洲一区影音先锋| 亚洲成人免费影院| 婷婷六月综合网| 日韩精品福利网| 石原莉奈一区二区三区在线观看| 亚洲国产精品久久一线不卡| 亚洲国产精品久久人人爱| 亚洲小说欧美激情另类| 午夜天堂影视香蕉久久| 日韩黄色免费网站| 免费观看在线色综合| 免费成人深夜小野草| 国产一区二区免费在线| 成人av中文字幕| 在线观看成人免费视频| 欧美精品日韩精品| 欧美变态tickling挠脚心| 2019国产精品| 国产精品久久久久久久久久久免费看 | 日韩写真欧美这视频| 精品国产成人在线影院| 国产欧美日韩综合精品一区二区| 国产精品区一区二区三| 亚洲色图清纯唯美| 亚洲第一福利视频在线| 久久精品国产色蜜蜜麻豆| 精品无码三级在线观看视频| 国产成人夜色高潮福利影视| 不卡av电影在线播放| 在线免费观看视频一区| 制服丝袜一区二区三区| 久久久国产精品不卡| 亚洲欧美一区二区三区国产精品| 亚洲午夜私人影院| 精品国产免费视频| 久久人人爽人人爽| 国产精品久久久久7777按摩| 亚洲狠狠丁香婷婷综合久久久| 天堂影院一区二区| 国产99久久久久久免费看农村| 972aa.com艺术欧美| 欧美一级片在线看| 亚洲欧美日韩中文播放| 日韩黄色免费网站| 93久久精品日日躁夜夜躁欧美| 欧美男生操女生| 中文成人综合网| 免费在线观看一区二区三区| 日韩欧美123| 亚洲国产综合91精品麻豆| 日韩一区二区免费在线电影| av动漫一区二区| 麻豆国产精品777777在线| 婷婷六月综合网| 亚洲在线视频一区| 国产精品久久久久影院色老大| 成人av资源下载| 色综合久久久久综合99| 成人黄色电影在线| 色婷婷久久综合| 欧美日韩精品三区| 欧美一级午夜免费电影| 日韩一区二区三免费高清| 国产亚洲美州欧州综合国| 国产精品剧情在线亚洲| 亚洲欧美视频在线观看视频| 夜夜爽夜夜爽精品视频| 婷婷久久综合九色综合绿巨人 | 午夜精品久久久久久久99水蜜桃| 亚洲欧洲性图库| 亚洲国产精品一区二区尤物区| 亚洲国产综合91精品麻豆| 日本女人一区二区三区| 麻豆精品精品国产自在97香蕉 | 亚洲欧美综合另类在线卡通| 一区二区三区四区乱视频| 亚洲一区视频在线| 国模一区二区三区白浆| 色婷婷综合久久久久中文一区二区| 欧美色图片你懂的| 精品国产乱码久久久久久图片| 国产精品美女久久福利网站| 亚洲va国产va欧美va观看| 国产高清在线观看免费不卡| 99re成人精品视频| 欧美v国产在线一区二区三区|