⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cipin.java~143~

📁 英语的自动句子权值计算程序
💻 JAVA~143~
字号:
package abstrac;
import java.util.*;

public class Cipin {
    Hashtable ha = new Hashtable();

    public void output(Hashtable ha) {
        Enumeration k=ha.keys();
        Enumeration e=ha.elements();
        for (; e.hasMoreElements() ;) {
                 System.out.print(k.nextElement().toString()+":");
                 System.out.println(e.nextElement().toString());
             }
    }

    /* 统计词频
     */
    public Hashtable tongji(String[] source) {
        Hashtable hb = new Hashtable();
        Exclude exclude = new Exclude();
        hb = exclude.comp(source);
        double cishu= 0;
        for (int i = 0; i < source.length; i++) {
            if (ha.containsKey(source[i])) {
                cishu = (Double) ha.get(source[i]);
                cishu +=1;
                ha.put(source[i], cishu);
            }
            else {
                //if(hb.get(source[i]).toString().equalsIgnoreCase("0"))
                ha.put(source[i], new Double(1));
            }
        }
        return ha;
    }
    public Hashtable youhua (Hashtable ha, String text){
        char c;
        String temp="";
        String[] title;
        double valueA;
        double valueB;
        Fenci fenci = new Fenci();
        Hashtable hb = new Hashtable();
        Enumeration k;
        for(int i = 0; i < text.length(); i++){
            c = text.charAt(i);
            if(c=='\n'){
                break;
            }
            if(c!='\n'||c!='\r'){
                temp += c;
            }
        }
        // System.out.print(temp);
        title = fenci.fenci1(temp);
        for(int i=0; i<title.length; i++){
            hb.put(title[i], new Double(1.3));
        }
        k = hb.keys();
        while (k.hasMoreElements()){
            temp = k.nextElement().toString().trim();
            valueA = (Double) ha.get(temp);
            valueB = (Double) hb.get(temp);
            valueA*= valueB;
            ha.put(temp,valueA);
        }
        //output(ha);

        return null;
    }


}













⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -