package OSI.VSQ.SSI.ASU.OSU.PSU.MSU.ASU.MPE.AOP.MEC.SIQ.search; import java.util.Iterator; import java.util.List; import java.util.Map; import AVQ.ASQ.OVQ.OSQ.VSQ.obj.WordFrequency; import ESU.list.List_ESU; import ESU.sort.Quick9DLYGWithString_ESU; import ME.APM.VSQ.App; import ME.APM.VSQ.文学性; import OSI.OPE.SI.SD.SU.SQ.ASU.OSU.PSU.MSU.AVQ.ASQ.ASU.MPE.procedure.pde.TokenPDI; //作者 罗瑶光 //思想 元基肽展公式 //作者,著作权人: 罗瑶光,浏阳 public class ZhongYaoSearch{ public static void zhongYaoSearch(App app, String zhongyao, String forE, String key) { String CatalyticDNA_xingwei= ""; String CatalyticDNA_gongxiao= ""; if(app.DNASearchIsClick) { TokenPDI pDE_RNA_Formular= new TokenPDI(); double rate= ((double)app.催化比值rot)/ 100; //pDE_RNA_Formular.key[0]= 0.3; pDE_RNA_Formular.key[1]= rate; pDE_RNA_Formular.key[2]= rate; //pDE_RNA_Formular.key[3]= 0.3; if(null!= app.nameFeelFilter.getText()) { pDE_RNA_Formular.pdw= app.nameFeelFilter.getText().toUpperCase(); pDE_RNA_Formular.code= pDE_RNA_Formular.pdw.toString().toUpperCase(); pDE_RNA_Formular.doKeyPress(pDE_RNA_Formular.code, pDE_RNA_Formular, false); CatalyticDNA_xingwei= null== pDE_RNA_Formular.pde?"" : pDE_RNA_Formular.pde.toString(); } // pDE_RNA_Formular.pde= ""; if(null!= app.name_filter_not_have.getText()) { pDE_RNA_Formular.pdw= app.name_filter_not_have.getText().toUpperCase(); pDE_RNA_Formular.code= pDE_RNA_Formular.pdw.toString().toUpperCase(); pDE_RNA_Formular.doKeyPress(pDE_RNA_Formular.code, pDE_RNA_Formular, false); CatalyticDNA_gongxiao= null== pDE_RNA_Formular.pde?"" : pDE_RNA_Formular.pde.toString(); } } String[] score= new String[app.copy.size()]; int[] score_code= new int[app.copy.size()]; int []reg= new int[app.copy.size()]; int count= 0; Map mapSearchWithoutSort= null; if(app.dic_map.containsKey(zhongyao.replaceAll(" ", ""))) { mapSearchWithoutSort= app._A.parserMixStringByReturnFrequencyMap(zhongyao); }else { String[] strings= key.split(" "); if(strings.length> 1&& key.split(" ")[0].length()> 5) { mapSearchWithoutSort= app._A.parserMixStringByReturnFrequencyMap(key); }else { mapSearchWithoutSort= app._A.parserMixStringByReturnFrequencyMap(zhongyao); } } Iterator iteratorForCopy= app.copy.iterator(); int copyCount= 0; List list= app._A.parserMixedString(key); String[] string= List_ESU.listToArray(list); String[] stringReg= new String[forE.length()/ 3]; for(int i= 0; i< stringReg.length; i++) { stringReg[i]= forE.substring(i* 3, (i* 3+ 3)< forE.length()? (i* 3+ 3): forE.length()- 1); } while(iteratorForCopy.hasNext()) { String iteratorForCopyString= iteratorForCopy.next(); score[copyCount]= iteratorForCopyString; String temps= app.dic_map.get(iteratorForCopyString).toString(); String tempsPCA= app.dic_li.get(iteratorForCopyString).toString(); String tempsIndex= app.dic_index.get(iteratorForCopyString).toString(); if(app.appConfig.SectionJPanel.jlabel_peizhi_di2233.isSelected()) {//文学性测试 if(null!= temps) {//既然都null了就跳过 temps= 文学性.文言文全文处理(app, temps); } if(null!= tempsPCA) { tempsPCA= 文学性.文言文线性处理(app, tempsPCA); } } Iterator iteratorWordFrequency= mapSearchWithoutSort.keySet().iterator(); Here: while(iteratorWordFrequency.hasNext()) { String mapSearchaAtII = iteratorWordFrequency.next(); WordFrequency wordFrequencySearch = mapSearchWithoutSort.get(mapSearchaAtII); if(temps.contains(mapSearchaAtII)) { if(reg[copyCount] == 0){ count += 1; } if(score[copyCount].contains(zhongyao.replace(" ", ""))) { reg[copyCount]+= 12; } if(zhongyao.contains(score[copyCount].replace(" ", ""))) { reg[copyCount]+= 12; } //因为这几行是新电脑开发的只有3行数据测试,老电脑写的拼音索引没用到,就出现这个问题 //,我先注释掉,以后优化. 罗瑶光20210516 if(tempsIndex.equalsIgnoreCase(zhongyao.replace(" ", ""))) { reg[copyCount]+= 1200; } if(tempsIndex.contains(zhongyao.replace(" ", "").toUpperCase())) { reg[copyCount]+= 1200; } score[copyCount]= iteratorForCopyString; if(!app.pos.containsKey(mapSearchaAtII)) { reg[copyCount]+= 1; score_code[copyCount]+= 1<< mapSearchaAtII.length() << wordFrequencySearch.getFrequency() ; if(tempsPCA.contains(mapSearchaAtII)) { score_code[copyCount] <<= 1; } if(score[copyCount].contains(mapSearchaAtII)) { if(score[copyCount].length()>1) { reg[copyCount]+= 22; } reg[copyCount]+= 3; } continue Here; } if(app.pos.get(mapSearchaAtII).contains("名") || app.pos.get(mapSearchaAtII).contains("动") || app.pos.get(mapSearchaAtII).contains("形") || app.pos.get(mapSearchaAtII).contains("谓")) { reg[copyCount]+= 2; if(tempsPCA.contains(mapSearchaAtII)) { reg[copyCount]<<= 1; } } reg[copyCount]+= 1; score_code[copyCount]+= (iteratorForCopyString.contains(mapSearchaAtII) ? 2: 1) << (!app.pos.get(mapSearchaAtII).contains("名") //测试了下不错,误差小,罗瑶光202111011900 ? app.pos.get(mapSearchaAtII).contains("动")? 3: 0: 7) //用位移替换10、1、150 // * (!app.pos.get(mapSearchaAtII).contains("名") // ? app.pos.get(mapSearchaAtII).contains("动")? 10: 1: 150) //用位移替换10、1、150 //动、、名 << mapSearchaAtII.length()* wordFrequencySearch.getFrequency(); if(score[copyCount].contains(mapSearchaAtII)) { if(score[copyCount].length()>1) { reg[copyCount]+= 22; } reg[copyCount]+= 3; } continue Here; } if(mapSearchaAtII.length()> 1) { for(int j= 0; j< mapSearchaAtII.length(); j++) { if(temps.contains(String.valueOf(mapSearchaAtII.charAt(j)))) { if(reg[copyCount]== 0){ count+= 1; } score[copyCount]= iteratorForCopyString; score_code[copyCount]+= 1; if(app.pos.containsKey(String.valueOf(mapSearchaAtII.charAt(j))) &&(app.pos.get(String.valueOf(mapSearchaAtII.charAt(j))).contains("名") ||app.pos.get(String.valueOf(mapSearchaAtII.charAt(j))).contains("动") ||app.pos.get(String.valueOf(mapSearchaAtII.charAt(j))).contains("形") ||app.pos.get(String.valueOf(mapSearchaAtII.charAt(j))).contains("谓") )) { reg[copyCount] += 2; } reg[copyCount] += 1; if(score[copyCount].contains(mapSearchaAtII)) { if(score[copyCount].length()>1) { reg[copyCount]+= 12; } reg[copyCount]+= 3; } continue Here; } } } } score_code[copyCount] = score_code[copyCount] * reg[copyCount]; //词距 //今天检查了没有封顶,会被 int 超出溢出问题。 score_code[copyCount] = score_code[copyCount]/ 1000; // int code= 200; int tempb= 0; int tempa= score_code[copyCount]; if(key.length()> 6) { //全词 for(int i= 0; i< string.length; i++) { if(temps.contains(string[i])&& string[i].length()>1 ) { tempb+= code; } } //断句 for(int i= 0; i< stringReg.length; i++) { if(temps.contains(stringReg[i])) { tempb+= code; } } score_code[copyCount] = (int) (tempa/Math.pow(app.lookrot+ 1, 4) + tempb*Math.pow(app.lookrot, 2)); } if(zhongyao.replace(" ", "").length()> 1&& zhongyao.replace(" ", "").length()< 5) { if(temps.contains(zhongyao.replace(" ", ""))) {//中药是编辑字符,这里用zhongyao八纲增新 tempb+= code<< 7; } if(temps.contains(key.replace(" ", ""))) {//key是原输入字符,这里用key 原搜补漏 tempb+= code<< 3; } score_code[copyCount] = (int) (tempa/Math.pow(app.lookrot+ 1, 4) + tempb*Math.pow(app.lookrot+ 1, 2)); } copyCount++; } //new Quick9DLYGWithString_ESU().sortZhongYao(score_code, score); new Quick9DLYGWithString_ESU().sort(score_code, score); Object[][] tableData= new Object[count][13]; int new_count = 0; app.newTableModel.getDataVector().clear(); if(null== key|| key.equals("")) { for(int i= 0; i < app.tableData_old.length; i++) { app.tableData_old[i][6]= app.tableData_old[i][6]==null? "": app.tableData_old[i][6]; app.newTableModel.insertRow(i, app.tableData_old[i]); } app.newTableModel.fireTableDataChanged(); return; } Here: for(int i = app.copy.size()-1; i > -1; i--) { if(score_code[i]< 1){ continue Here; } if(app.risk_filter_box.isSelected()) { String hai= (app.dic_hai.get(score[i])== null? "null." : app.dic_hai.get(score[i]).toString().replaceAll("\\s*", "") .equalsIgnoreCase("")? "null": app.dic_hai.get(score[i]).toString() .replaceAll("\\s*", "")); String temp= app.name_filter.getText(); for(int j=0;j