14 Star 79 Fork 15

罗瑶光 / 快速中文分词分析word segmentation

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
POSControllerImp.java 46.75 KB
一键复制 编辑 原始数据 按行查看 历史
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
package org.tinos.engine.pos.imp;
import java.util.List;
import java.util.Map;
import org.tinos.engine.pos.POSController;
import org.tinos.view.obj.WordFrequency;
import org.tinos.view.stable.StableData;
import org.tinos.view.stable.StableMaps;
public class POSControllerImp implements POSController{
public int chuLiMingCiOfThree(Map<String, String> wordsForest, List<String> outputList, int countInputStringLength,
String[] strings, StringBuilder[] fixWord){
if (StableMaps.xingWeiCi.containsKey(fixWord[StableData.INT_ZERO].toString())|| StableMaps.mingCi
.containsKey(fixWord[StableData.INT_ZERO].toString())){
if(StableMaps.dongCi.containsKey(strings[StableData.INT_TWO])){
countInputStringLength= parserFirstCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
if(StableMaps.dongCi.containsKey(strings[StableData.INT_THREE])){
if(StableMaps.fuCi.containsKey(StableData.EMPTY_STRING+ fixWord[StableData.INT_ONE].charAt(StableData.INT_ZERO))){
if(StableMaps.dongCi.containsKey(strings[StableData.INT_ONE])|| StableMaps.qingTaiCi.containsKey(strings[StableData.INT_ONE])) {
countInputStringLength= parserFirstTwoCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
outputList.add(strings[StableData.INT_ZERO]);
if (StableMaps.CiTwo.containsKey(strings[StableData.INT_TWO])){
outputList.add(strings[StableData.INT_TWO]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_TWO]);
return countInputStringLength;
}
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ZERO]);
return countInputStringLength= StableData.INT_ONE;
}
if(!StableMaps.dingMingCi.containsKey(strings[StableData.INT_ZERO])){
if (StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])){
countInputStringLength= parserFirstTwoCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
outputList.add(strings[StableData.INT_ZERO]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ZERO]);
return countInputStringLength= StableData.INT_ONE;
}
}
if(StableMaps.mingCi.containsKey(strings[StableData.INT_TWO])){
if(StableData.INT_ZERO< fixWord[StableData.INT_ONE].length()&& StableMaps.zhuCi.containsKey(StableData.EMPTY_STRING
+ fixWord[StableData.INT_ONE].charAt(StableData.INT_ZERO))){
if(StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])) {
if(!StableMaps.dongCi.containsKey(fixWord[StableData.INT_ZERO].toString())){
countInputStringLength= parserFirstCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
countInputStringLength= parserFirstTwoCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
outputList.add(strings[StableData.INT_ZERO]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ZERO]);
return countInputStringLength= StableData.INT_ONE;
}
countInputStringLength= parserFirstCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
if(StableMaps.mingCi.containsKey(strings[StableData.INT_ONE])|| StableMaps.fuCi.containsKey(strings[StableData.INT_ONE])){
countInputStringLength= parserFirstTwoCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
if (StableMaps.CiTwo.containsKey(strings[StableData.INT_TWO])){
countInputStringLength= parserFirstCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
outputList.add(strings[StableData.INT_ZERO]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ZERO]);
countInputStringLength= StableData.INT_ONE;
return countInputStringLength;
}
if(StableMaps.dongCi.containsKey(strings[StableData.INT_THREE])){
if(StableMaps.dongCi.containsKey(strings[StableData.INT_TWO])){
if(StableMaps.mingCi.containsKey(strings[StableData.INT_ZERO])) {
countInputStringLength= parserFirstCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
}
if(null!= fixWord[StableData.INT_ZERO]&& StableData.INT_ZERO<fixWord[StableData.INT_ZERO].length()){
if(StableMaps.zhuCi.containsKey(StableData.EMPTY_STRING+ fixWord[StableData.INT_ZERO].charAt(StableData.INT_ZERO))){
if(!StableMaps.mingCi.containsKey(strings[StableData.INT_ONE])) {
countInputStringLength= parserFirstCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
}
}
if(StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])) {
countInputStringLength= parserFirstTwoCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
countInputStringLength= parserFirstCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
if(StableMaps.mingCi.containsKey(strings[StableData.INT_TWO])){
if(StableData.INT_ZERO< fixWord[StableData.INT_ONE].length()&& StableMaps.zhuCi.containsKey(StableData.EMPTY_STRING
+ fixWord[StableData.INT_ONE].charAt(StableData.INT_ZERO))){
if(StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])){
if(!StableMaps.dongCi.containsKey(fixWord[StableData.INT_ZERO].toString())){
countInputStringLength= parserFirstCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
countInputStringLength= parserFirstTwoCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
countInputStringLength= parserFirstCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
if(StableData.INT_ZERO< fixWord[StableData.INT_ONE].length()&& StableMaps.dingMingCi.containsKey(StableData.EMPTY_STRING
+ fixWord[StableData.INT_ONE].charAt(StableData.INT_ZERO))){
countInputStringLength= parserFirstTwoCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
if(StableMaps.dongCi.containsKey(fixWord[StableData.INT_ZERO].toString())){
if (StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])){
countInputStringLength= parserFirstTwoCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
}
if(StableData.INT_ZERO== fixWord[StableData.INT_ZERO].length()
|| StableMaps.jieCi.containsKey(fixWord[StableData.INT_ZERO].toString())){
if (StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])){
countInputStringLength= parserFirstTwoCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
}
countInputStringLength= parserFirstCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
if (StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])){
outputList.add(strings[StableData.INT_ONE]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ONE]);
countInputStringLength= StableData.INT_TWO;
return countInputStringLength;
}
outputList.add(strings[StableData.INT_ZERO]);
if(StableMaps.CiTwo.containsKey(strings[StableData.INT_TWO])) {
outputList.add(strings[StableData.INT_TWO]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_TWO]);
return countInputStringLength;
}
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ZERO]);
return countInputStringLength= StableData.INT_ONE;
}
public int chuLiShiTaiCiOfThree(Map<String, String> wordsForest, List<String> outputList, int countInputLength,
String[] strings, StringBuilder[] prefixWord) {
if ((StableMaps.mingCi.containsKey(strings[StableData.INT_TWO].toString()))
&& (StableMaps.jieCi.containsKey(prefixWord[StableData.INT_ZERO].toString())
|| StableMaps.xingWeiCi.containsKey(prefixWord[StableData.INT_ZERO].toString())
|| StableMaps.dongCi.containsKey(prefixWord[StableData.INT_ZERO].toString()))){
countInputLength= parserFirstCharOfThree(countInputLength, outputList, strings, prefixWord);
return countInputLength;
}
if (StableMaps.dongCi.containsKey(strings[StableData.INT_TWO].toString())
||StableMaps.liangCi.containsKey(strings[StableData.INT_TWO].toString())) {
countInputLength= parserFirstCharOfThree(countInputLength, outputList, strings, prefixWord);
return countInputLength;
}
if (StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])){
outputList.add(strings[StableData.INT_ONE]);
prefixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, prefixWord[StableData.INT_ZERO].length());
prefixWord[StableData.INT_ZERO].append(strings[StableData.INT_ONE]);
countInputLength= StableData.INT_TWO;
return countInputLength;
}
outputList.add(strings[StableData.INT_ZERO]);
if(StableMaps.CiTwo.containsKey(strings[StableData.INT_TWO])) {
outputList.add(strings[StableData.INT_TWO]);
prefixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, prefixWord[StableData.INT_ZERO].length());
prefixWord[StableData.INT_ZERO].append(strings[StableData.INT_TWO]);
return countInputLength;
}
prefixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, prefixWord[StableData.INT_ZERO].length());
prefixWord[StableData.INT_ZERO].append(strings[StableData.INT_ZERO]);
return countInputLength= StableData.INT_ONE;
}
public int chuLiFuCiOfThree(Map<String, String> wordsForest, List<String> outputList, int countInputLength,
String[] strings, StringBuilder[] prefixWord) {
if (StableMaps.fuCi.containsKey(strings[StableData.INT_TWO].toString())) {
if (StableMaps.fuCi.containsKey(prefixWord[StableData.INT_ZERO].toString())) {
countInputLength= parserFirstCharOfThree(countInputLength, outputList, strings, prefixWord);
return countInputLength;
}
}
if (StableMaps.dongCi.containsKey(strings[StableData.INT_TWO].toString())) {
if (StableMaps.zhuCi.containsKey(StableData.EMPTY_STRING+ prefixWord[StableData.INT_ONE].charAt(StableData.INT_ZERO))
|| StableMaps.daiCi.containsKey(StableData.EMPTY_STRING+ prefixWord[StableData.INT_ONE].charAt(StableData.INT_ZERO))) {
countInputLength= parserFirstCharOfThree(countInputLength, outputList, strings, prefixWord);
return countInputLength;
}
}
if(StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])) {
countInputLength= parserFirstTwoCharOfThree(countInputLength, outputList, strings, prefixWord);
return countInputLength;
}
outputList.add(strings[StableData.INT_ZERO]);
prefixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, prefixWord[StableData.INT_ZERO].length());
prefixWord[StableData.INT_ZERO].append(strings[StableData.INT_ZERO]);
return StableData.INT_ONE;
}
public int chuLiBaDongCiOfTwo(Map<String, String> wordsForest, List<String> outputList, int countInputStringLength,
String[] strings, StringBuilder[] prefixWord){
if (!wordsForest.containsKey(prefixWord[StableData.INT_ZERO].toString())){
return countInputStringLength;
}
if (StableMaps.daiCi.containsKey(prefixWord[StableData.INT_ZERO].toString())
||StableMaps.fuCi.containsKey(prefixWord[StableData.INT_ZERO].toString())) {
countInputStringLength = parserFirstCharOfTwo(countInputStringLength, outputList, strings, prefixWord);
return countInputStringLength;
}
if (StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])){
outputList.add(strings[StableData.INT_ONE]);
prefixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, prefixWord[StableData.INT_ZERO].length());
prefixWord[StableData.INT_ZERO].append(strings[StableData.INT_ONE]);
return countInputStringLength;
}
return countInputStringLength- StableData.INT_TWO;
}
public int chuLiMingCiOfTwo(Map<String, String> wordsForest, List<String> outputList, int countInputStringLength
, String[] strings, StringBuilder[] fixWord, int charPosition, String inputString){
if (wordsForest.containsKey(fixWord[StableData.INT_ZERO].toString())){
if (StableMaps.liangCi.containsKey(fixWord[StableData.INT_ZERO].toString())){
countInputStringLength= parserFirstCharOfTwo(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
if (StableMaps.dongCi.containsKey(fixWord[StableData.INT_ZERO].toString())
||StableMaps.xingRongCi.containsKey(fixWord[StableData.INT_ZERO].toString())
||StableMaps.mingCi.containsKey(fixWord[StableData.INT_ZERO].toString())
||StableMaps.zhuCi.containsKey(fixWord[StableData.INT_ZERO].toString())
||StableMaps.liangCi.containsKey(fixWord[StableData.INT_ZERO].toString())){
if(StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])) {
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ONE]);
outputList.add(strings[StableData.INT_ONE]);
return countInputStringLength;
}
countInputStringLength= parserFirstCharOfTwo(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
addFixWordsOfTwo(charPosition, inputString, fixWord);
if (StableData.INT_ZERO< fixWord[StableData.INT_ONE].length()&& StableMaps.fuCi.containsKey(StableData.EMPTY_STRING
+ fixWord[StableData.INT_ONE].toString().charAt(StableData.INT_ZERO))){
countInputStringLength= parserFirstCharOfTwo(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
if (StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])){
outputList.add(strings[StableData.INT_ONE]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ONE]);
return countInputStringLength;
}
countInputStringLength= parserFirstCharOfTwo(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
return countInputStringLength;
}
public void addFixWordsOfTwo(int charPosition, String inputString, StringBuilder[] fixWords) {
fixWords[StableData.INT_ONE].delete(StableData.INT_ZERO, fixWords[StableData.INT_ONE].length());
if (charPosition+ StableData.INT_SEVEN < inputString.length()) {
fixWords[StableData.INT_ONE].append(inputString.substring(charPosition + StableData.INT_TWO
, charPosition + StableData.INT_SEVEN));
return;
}
fixWords[StableData.INT_ONE].append(inputString.substring(charPosition + StableData.INT_TWO
, inputString.length()));
}
public int parserFirstCharOfTwo(int countInputStringLength, List<String> outputList, String[] strings
, StringBuilder[] fixWord){
outputList.add(strings[StableData.INT_ZERO]);
String postNext=StableData.EMPTY_STRING + strings[StableData.INT_ONE].charAt(StableData.INT_ONE);
outputList.add(postNext);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(postNext);
return countInputStringLength;
}
public int chuLiLianCiPostFixOfThree(Map<String, String> wordsForest, List<String> outputList, int countInputLength,
String[] strings, StringBuilder[] prefixWord) {
if (StableMaps.lianCi.containsKey(strings[StableData.INT_TWO])){
countInputLength= parserFirstCharOfThree(countInputLength, outputList, strings, prefixWord);
return countInputLength;
}
if (StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])){
countInputLength= parserFirstTwoCharOfThree(countInputLength, outputList, strings, prefixWord);
return countInputLength;
}
return countInputLength;
}
public int chuLiLianCiOfThree(Map<String, String> wordsForest, List<String> outputList, int countInputStringLength
, String[] strings, StringBuilder[] fixWord){
if (outputList.size() == StableData.INT_ZERO){
didNotFindFirstChar(outputList, strings, fixWord, wordsForest);
return countInputStringLength;
}
if (wordsForest.containsKey(fixWord[StableData.INT_ZERO].toString()) && (StableMaps.mingCi.containsKey(fixWord[StableData.INT_ZERO].toString())
|| StableMaps.dongCi.containsKey(fixWord[StableData.INT_ZERO].toString())|| StableMaps.fuCi.containsKey(fixWord[StableData.INT_ZERO].toString())
|| StableMaps.daiCi.containsKey(fixWord[StableData.INT_ZERO].toString()) || StableMaps.weiCi.containsKey(fixWord[StableData.INT_ZERO].toString()))){
countInputStringLength = parserFirstCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
if (wordsForest.containsKey(fixWord[StableData.INT_ZERO].toString()) && (StableMaps.zhuCi.containsKey(fixWord[StableData.INT_ZERO].toString())
|| StableMaps.shengLueCi.containsKey(fixWord[StableData.INT_ZERO].toString()))){
for (int BackPosition = StableData.INT_ZERO; BackPosition < fixWord[StableData.INT_ONE].length(); BackPosition++){
int[] nestCountInputStringLength = new int[StableData.INT_ONE];
int result = loopCheckBackFix(fixWord, BackPosition, wordsForest, countInputStringLength, outputList, strings
, nestCountInputStringLength);
if (result == StableData.INT_RIGHT){
return nestCountInputStringLength[StableData.INT_ZERO];
}
}
if (StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])){
outputList.add(strings[StableData.INT_ONE]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ONE]);
return countInputStringLength- StableData.INT_ONE;
}
return countInputStringLength- StableData.INT_THREE;
}
if (StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])){
outputList.add(strings[StableData.INT_ONE]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
return countInputStringLength- StableData.INT_ONE;
}
return countInputStringLength- StableData.INT_THREE;
}
public int loopCheckBackFix(StringBuilder[] fixWord, int backPosition, Map<String, String> wordsForest
, int countInputStringLength, List<String> outputList, String[] strings, int[] nestCountInputStringLength){
String charPositionAtFixWord = StableData.EMPTY_STRING + fixWord[StableData.INT_ONE].charAt(backPosition);
if (wordsForest.containsKey(charPositionAtFixWord) && (StableMaps.zhuCi.containsKey(charPositionAtFixWord)
|| StableMaps.shengLueCi.containsKey(charPositionAtFixWord)|| StableMaps.fuCi.containsKey(charPositionAtFixWord))){
if(!wordsForest.get(fixWord[StableData.INT_ZERO].toString()).contains(StableData.NLP_CI_SHENG_LUE)
&& wordsForest.get(charPositionAtFixWord).contains(StableData.NLP_CI_FU)){
return StableData.INT_ERROR;
}
nestCountInputStringLength[StableData.INT_ZERO]= parserFirstCharOfThree(countInputStringLength, outputList
, strings, fixWord);
return StableData.INT_RIGHT;
}
return StableData.INT_ERROR;
}
public void didNotFindFirstChar(List<String> outputList, String[] strings, StringBuilder[] fixWord
, Map<String, String> wordsForest){
if(!StableMaps.CiTwo.containsKey(strings[StableData.INT_TWO])){
if(StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])){
outputList.add(strings[StableData.INT_ONE]);
outputList.add(strings[StableData.INT_THREE]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_THREE]);
}
return;
}
if (StableMaps.fuCi.containsKey(strings[StableData.INT_TWO])){
outputList.add(strings[StableData.INT_ZERO]);
outputList.add(strings[StableData.INT_TWO]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_TWO]);
return;
}
if(StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])){
outputList.add(strings[StableData.INT_ONE]);
outputList.add(strings[StableData.INT_THREE]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_THREE]);
}
}
public int parserFirstCharOfThree(int countInputStringLength, List<String> outputList, String[] strings
, StringBuilder[] fixWord){
outputList.add(strings[StableData.INT_ZERO]);
outputList.add(strings[StableData.INT_TWO]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_TWO]);
return countInputStringLength;
}
public int parserFirstTwoCharOfThree(int countInputStringLength, List<String> outputList, String[] strings
, StringBuilder[] fixWord){
outputList.add(strings[StableData.INT_ONE]);
outputList.add(strings[StableData.INT_THREE]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_THREE]);
return countInputStringLength;
}
public int chuLiZhuCiOfThree(Map<String, String> wordsForest, List<String> outputList, int countInputStringLength
, String[] strings, StringBuilder[] fixWord){
if (StableData.INT_ZERO== outputList.size()){
didNotFindFirstChar(outputList, strings, fixWord, wordsForest);
return countInputStringLength;
}
if (wordsForest.containsKey(fixWord[StableData.INT_ZERO].toString())){
if (StableMaps.dongCi.containsKey(fixWord[StableData.INT_ZERO].toString())){
if(StableMaps.CiTwo.containsKey(strings[StableData.INT_TWO])) {
countInputStringLength = parserFirstCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
outputList.add(strings[StableData.INT_ZERO]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ZERO]);
return countInputStringLength= StableData.INT_ONE;
} else if(fixWord[StableData.INT_ONE].length()> StableData.INT_ONE) {
String firstChar= StableData.EMPTY_STRING+ fixWord[StableData.INT_ONE].toString().charAt(StableData.INT_ZERO);
String secondChar= StableData.EMPTY_STRING+ fixWord[StableData.INT_ONE].toString().charAt(StableData.INT_ONE);
if(!StableMaps.fuCi.containsKey(firstChar)&& !StableMaps.fuCi.containsKey(secondChar)
&&!StableMaps.fuCi.containsKey(firstChar+ secondChar)) {
if(StableMaps.CiOne.containsKey(firstChar)&& StableMaps.CiOne.containsKey(secondChar)) {
outputList.add(strings[StableData.INT_ZERO]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ZERO]);
countInputStringLength= StableData.INT_ONE;
if(StableMaps.CiTwo.containsKey(strings[StableData.INT_TWO])) {
outputList.add(strings[StableData.INT_TWO]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_TWO]);
countInputStringLength= StableData.INT_THREE;
}
return countInputStringLength;
}
}
}
if (StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])){
outputList.add(strings[StableData.INT_ONE]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ONE]);
return countInputStringLength- StableData.INT_ONE;
}
if (StableMaps.CiTwo.containsKey(strings[StableData.INT_TWO])){
outputList.add(strings[StableData.INT_ZERO]);
outputList.add(strings[StableData.INT_TWO]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_TWO]);
return countInputStringLength;
}
}
return countInputStringLength;
}
public int chuLiJieCiOfThree(Map<String, String> wordsForest, List<String> outputList, int countInputStringLength
, String[] strings, StringBuilder[] fixWord){
if (StableData.INT_ZERO== outputList.size()&& (StableMaps.CiTwo.get(strings[StableData.INT_TWO])
.contains(StableData.NLP_CI_WEI))){
outputList.add(strings[StableData.INT_ZERO]);
outputList.add(strings[StableData.INT_TWO]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_TWO]);
return countInputStringLength;
}
if (outputList.size() > StableData.INT_ZERO&& wordsForest.containsKey(fixWord[StableData.INT_ZERO].toString())){
if (StableMaps.qingTaiCi.containsKey(fixWord[StableData.INT_ZERO].toString())
|| StableMaps.weiCi.containsKey(fixWord[StableData.INT_ZERO].toString())
|| StableMaps.lianCi.containsKey(fixWord[StableData.INT_ZERO].toString())){
countInputStringLength= parserFirstCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
} else{
if(StableMaps.dongCi.containsKey(fixWord[StableData.INT_ZERO].toString())) {
if(StableMaps.xingWeiCi.containsKey(strings[StableData.INT_ONE])
|| StableMaps.xingRongCi.containsKey(strings[StableData.INT_ONE])) {
countInputStringLength= parserFirstTwoCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
}
if (StableMaps.mingCi.containsKey(strings[StableData.INT_TWO])){
outputList.add(strings[StableData.INT_ZERO]);
outputList.add(strings[StableData.INT_TWO]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_TWO]);
return countInputStringLength;
}else if (StableMaps.CiTwo.containsKey(strings[StableData.INT_ONE])){
if(StableMaps.jieCi.containsKey(strings[StableData.INT_ONE])) {
countInputStringLength= parserFirstTwoCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
outputList.add(strings[StableData.INT_ONE]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ONE]);
countInputStringLength = StableData.INT_TWO;
return countInputStringLength;
}else if (StableMaps.CiTwo.containsKey(strings[StableData.INT_TWO])){
outputList.add(strings[StableData.INT_ZERO]);
outputList.add(strings[StableData.INT_TWO]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_TWO]);
return countInputStringLength;
}
}
}
if(StableMaps.jieCi.containsKey(strings[StableData.INT_ONE])) {
countInputStringLength= parserFirstTwoCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
outputList.add(strings[StableData.INT_ZERO]);
if(StableMaps.CiTwo.containsKey(strings[StableData.INT_TWO])) {
outputList.add(strings[StableData.INT_TWO]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_TWO]);
return countInputStringLength;
}
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ZERO]);
return countInputStringLength= StableData.INT_ONE;
}
public int chuLiLiangCiOfThree(Map<String, String> wordsForest, List<String> outputList, int countInputStringLength
, String[] strings, StringBuilder[] fixWord){
if (wordsForest.containsKey(fixWord[StableData.INT_ZERO].toString())){
if (StableMaps.mingCi.containsKey(fixWord[StableData.INT_ZERO].toString())|| StableMaps.daiCi.containsKey(fixWord[StableData.INT_ZERO].toString())){
countInputStringLength = parserFirstCharOfThree(countInputStringLength, outputList, strings, fixWord);
return countInputStringLength;
}
if (StableMaps.liangCi.containsKey(strings[StableData.INT_ONE])){
outputList.add(strings[StableData.INT_ONE]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ONE]);
return StableData.INT_TWO;
}
if ((StableMaps.xingWeiCi.containsKey(fixWord[StableData.INT_ZERO].toString())||StableMaps.xingRongCi.containsKey(fixWord[StableData.INT_ZERO].toString()))
&& StableMaps.mingCi.containsKey(strings[StableData.INT_ONE])){
outputList.add(strings[StableData.INT_ONE]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ONE]);
return StableData.INT_TWO;
}
}
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ZERO]);
outputList.add(strings[StableData.INT_ZERO]);
if (StableMaps.CiTwo.containsKey(strings[StableData.INT_TWO])){
outputList.add(strings[StableData.INT_TWO]);
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_TWO]);
return StableData.INT_THREE;
}
return StableData.INT_ONE;
}
//
public int chuLiMingCiOfTwoForMap(Map<String, String> wordsForest, Map<String, WordFrequency> outputList, int countInputStringLength
, String[] strings, StringBuilder[] fixWord){
if (wordsForest.containsKey(fixWord[StableData.INT_ZERO].toString())){
if (StableMaps.liangCi.containsKey(fixWord[StableData.INT_ZERO].toString())){
countInputStringLength = parserFirstCharOfTwoForMap(countInputStringLength, outputList, strings, fixWord
, wordsForest);
return countInputStringLength;
}
countInputStringLength -= StableData.INT_TWO;
if (wordsForest.containsKey(strings[StableData.INT_ONE])){
if (outputList.containsKey(strings[StableData.INT_ONE])){
WordFrequency wordFrequency = outputList.get(strings[StableData.INT_ONE]);
wordFrequency.setFrequency(wordFrequency.getFrequency() + StableData.INT_ONE);
outputList.put(strings[StableData.INT_ONE], wordFrequency);
} else{
WordFrequency wordFrequency = new WordFrequency();
wordFrequency.setFrequency(StableData.INT_ONE);
wordFrequency.setWord(strings[StableData.INT_ONE]);
outputList.put(strings[StableData.INT_ONE], wordFrequency);
}
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ONE]);
countInputStringLength += StableData.INT_TWO;
}
return countInputStringLength;
}
return countInputStringLength;
}
public int parserFirstCharOfTwoForMap(int countInputStringLength, Map<String, WordFrequency> outputList, String[] strings
, StringBuilder[] fixWord, Map<String, String> wordsForest){
countInputStringLength -= StableData.INT_TWO;
if (outputList.containsKey(strings[StableData.INT_ZERO])){
WordFrequency wordFrequency = outputList.get(strings[StableData.INT_ZERO]);
wordFrequency.setFrequency(wordFrequency.getFrequency() + StableData.INT_ONE);
outputList.put(strings[StableData.INT_ZERO], wordFrequency);
} else{
WordFrequency wordFrequency = new WordFrequency();
wordFrequency.setFrequency(StableData.INT_ONE);
wordFrequency.setWord(strings[StableData.INT_ZERO]);
outputList.put(strings[StableData.INT_ZERO], wordFrequency);
}
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ZERO]);
countInputStringLength += StableData.INT_ONE;
return countInputStringLength;
}
public int chuLiLiangCiOfThreeForMap(Map<String, String> wordsForest, Map<String, WordFrequency> outputList, int countInputStringLength
, String[] strings, StringBuilder[] fixWord){
if (wordsForest.containsKey(fixWord[StableData.INT_ZERO].toString())){
if (StableMaps.mingCi.containsKey(fixWord[StableData.INT_ZERO].toString())|| StableMaps.daiCi.containsKey(fixWord[StableData.INT_ZERO].toString())){
countInputStringLength= parserFirstCharOfThreeForMap(countInputStringLength, outputList, strings, fixWord
, wordsForest);
return countInputStringLength;
}
countInputStringLength -= StableData.INT_THREE;
if (wordsForest.containsKey(strings[StableData.INT_ONE])){
if (outputList.containsKey(strings[StableData.INT_ONE])){
WordFrequency wordFrequency = outputList.get(strings[StableData.INT_ONE]);
wordFrequency.setFrequency(wordFrequency.getFrequency() + StableData.INT_ONE);
outputList.put(strings[StableData.INT_ONE], wordFrequency);
} else{
WordFrequency wordFrequency = new WordFrequency();
wordFrequency.setFrequency(StableData.INT_ONE);
wordFrequency.setWord(strings[StableData.INT_ONE]);
outputList.put(strings[StableData.INT_ONE], wordFrequency);
}
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ONE]);
countInputStringLength += StableData.INT_TWO;
}
return countInputStringLength;
}
return countInputStringLength;
}
public int chuLiJieCiOfThreeForMap(Map<String, String> wordsForest, Map<String, WordFrequency> outputList, int countInputStringLength
, String[] strings, StringBuilder[] fixWord){
if (outputList.size()== StableData.INT_ZERO&& StableMaps.weiCi.containsKey(strings[StableData.INT_TWO])){
if (outputList.containsKey(strings[StableData.INT_ZERO])){
WordFrequency wordFrequency= outputList.get(strings[StableData.INT_ZERO]);
wordFrequency.setFrequency(wordFrequency.getFrequency()+ StableData.INT_ONE);
outputList.put(strings[StableData.INT_ZERO], wordFrequency);
} else{
WordFrequency wordFrequency= new WordFrequency();
wordFrequency.setFrequency(StableData.INT_ONE);
wordFrequency.setWord(strings[StableData.INT_ZERO]);
outputList.put(strings[StableData.INT_ZERO], wordFrequency);
}
if (outputList.containsKey(strings[StableData.INT_TWO])){
WordFrequency wordFrequency= outputList.get(strings[StableData.INT_TWO]);
wordFrequency.setFrequency(wordFrequency.getFrequency()+ StableData.INT_ONE);
outputList.put(strings[StableData.INT_TWO], wordFrequency);
} else{
WordFrequency wordFrequency= new WordFrequency();
wordFrequency.setFrequency(StableData.INT_ONE);
wordFrequency.setWord(strings[StableData.INT_TWO]);
outputList.put(strings[StableData.INT_TWO], wordFrequency);
}
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_TWO]);
return countInputStringLength;
}
if (outputList.size()> StableData.INT_ZERO&& wordsForest.containsKey(fixWord[StableData.INT_ZERO].toString())){
if (StableMaps.lianCi.containsKey(fixWord[StableData.INT_ZERO].toString())|| StableMaps.qingTaiCi.containsKey(fixWord[StableData.INT_ZERO].toString())
|| StableMaps.weiCi.containsKey(fixWord[StableData.INT_ZERO].toString())){
countInputStringLength= parserFirstCharOfThreeForMap(countInputStringLength, outputList, strings, fixWord, wordsForest);
return countInputStringLength;
} else{
countInputStringLength-= StableData.INT_THREE;
if (wordsForest.containsKey(strings[StableData.INT_ONE])){
if (outputList.containsKey(strings[StableData.INT_ONE])){
WordFrequency wordFrequency= outputList.get(strings[StableData.INT_ONE]);
wordFrequency.setFrequency(wordFrequency.getFrequency()+ StableData.INT_ONE);
outputList.put(strings[StableData.INT_ONE], wordFrequency);
} else{
WordFrequency wordFrequency= new WordFrequency();
wordFrequency.setFrequency(StableData.INT_ONE);
wordFrequency.setWord(strings[StableData.INT_ONE]);
outputList.put(strings[StableData.INT_ONE], wordFrequency);
}
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ONE]);
countInputStringLength+= StableData.INT_TWO;
}
return countInputStringLength;
}
}
return countInputStringLength;
}
public int chuLiLianCiOfThreeForMap(Map<String, String> wordsForest, Map<String, WordFrequency> outputList, int countInputStringLength
, String[] strings, StringBuilder[] fixWord){
if (outputList.size()== StableData.INT_ZERO){
didNotFindFirstCharForMap(outputList, strings, fixWord, wordsForest);
return countInputStringLength;
}
if (wordsForest.containsKey(fixWord[StableData.INT_ZERO].toString())
&& (StableMaps.mingCi.containsKey(fixWord[StableData.INT_ZERO].toString())
|| StableMaps.daiCi.containsKey(fixWord[StableData.INT_ZERO].toString())
|| StableMaps.weiCi.containsKey(fixWord[StableData.INT_ZERO].toString())
|| StableMaps.dongCi.containsKey(fixWord[StableData.INT_ZERO].toString())
|| StableMaps.fuCi.containsKey(fixWord[StableData.INT_ZERO].toString()))){
countInputStringLength = parserFirstCharOfThreeForMap(countInputStringLength, outputList, strings, fixWord, wordsForest);
return countInputStringLength;
}
if (wordsForest.containsKey(fixWord[StableData.INT_ZERO].toString())
&& (StableMaps.zhuCi.containsKey(fixWord[StableData.INT_ZERO].toString())
|| StableMaps.shengLueCi.containsKey(fixWord[StableData.INT_ZERO].toString()))){
for (int BackPosition= StableData.INT_ZERO; BackPosition< fixWord[StableData.INT_ONE].length(); BackPosition++){
int[] nestCountInputStringLength = new int[StableData.INT_ONE];
int result= loopCheckBackFixForMap(fixWord, BackPosition, wordsForest, countInputStringLength, outputList, strings
, nestCountInputStringLength);
if (result== StableData.INT_RIGHT){
return nestCountInputStringLength[StableData.INT_ZERO];
}
}
countInputStringLength-= StableData.INT_THREE;
if (wordsForest.containsKey(strings[StableData.INT_ONE])){
if (outputList.containsKey(strings[StableData.INT_ONE])){
WordFrequency wordFrequency= outputList.get(strings[StableData.INT_ONE]);
wordFrequency.setFrequency(wordFrequency.getFrequency() + StableData.INT_ONE);
outputList.put(strings[StableData.INT_ONE], wordFrequency);
} else{
WordFrequency wordFrequency = new WordFrequency();
wordFrequency.setFrequency(StableData.INT_ONE);
wordFrequency.setWord(strings[StableData.INT_ONE]);
outputList.put(strings[StableData.INT_ONE], wordFrequency);
}
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ONE]);
countInputStringLength += StableData.INT_TWO;
}
return countInputStringLength;
}
countInputStringLength-= StableData.INT_THREE;
if (wordsForest.containsKey(strings[StableData.INT_ONE])){
if (outputList.containsKey(strings[StableData.INT_ONE])){
WordFrequency wordFrequency = outputList.get(strings[StableData.INT_ONE]);
wordFrequency.setFrequency(wordFrequency.getFrequency()+ StableData.INT_ONE);
outputList.put(strings[StableData.INT_ONE], wordFrequency);
} else{
WordFrequency wordFrequency= new WordFrequency();
wordFrequency.setFrequency(StableData.INT_ONE);
wordFrequency.setWord(strings[StableData.INT_ONE]);
outputList.put(strings[StableData.INT_ONE], wordFrequency);
}
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
countInputStringLength+= StableData.INT_TWO;
}
return countInputStringLength;
}
public int loopCheckBackFixForMap(StringBuilder[] fixWord, int backPosition, Map<String, String> wordsForest
, int countInputStringLength, Map<String, WordFrequency> outputList, String[] strings, int[] nestCountInputStringLength){
String charPositionAtFixWord= StableData.EMPTY_STRING+ fixWord[StableData.INT_ONE].charAt(backPosition);
if (wordsForest.containsKey(charPositionAtFixWord)&& (StableMaps.zhuCi.containsKey(charPositionAtFixWord)
|| wordsForest.get(charPositionAtFixWord).contains(StableData.NLP_CI_SHENG_LUE))){
nestCountInputStringLength[StableData.INT_ZERO]= parserFirstCharOfThreeForMap(countInputStringLength, outputList
, strings, fixWord, wordsForest);
return StableData.INT_RIGHT;
}
return StableData.INT_ERROR;
}
public int chuLiZhuCiOfThreeForMap(Map<String, String> wordsForest, Map<String, WordFrequency> outputList, int countInputStringLength
, String[] strings, StringBuilder[] fixWord){
if (StableData.INT_ZERO== outputList.size()){
didNotFindFirstCharForMap(outputList, strings, fixWord, wordsForest);
return countInputStringLength;
}
if (wordsForest.containsKey(fixWord[StableData.INT_ZERO].toString())){
if (StableMaps.dongCi.containsKey(fixWord[StableData.INT_ZERO].toString())){
countInputStringLength= parserFirstCharOfThreeForMap(countInputStringLength, outputList, strings, fixWord, wordsForest);
return countInputStringLength;
} else{
countInputStringLength-= StableData.INT_THREE;
if (wordsForest.containsKey(strings[StableData.INT_ONE])){
if (outputList.containsKey(strings[StableData.INT_ONE])){
WordFrequency wordFrequency= outputList.get(strings[StableData.INT_ONE]);
wordFrequency.setFrequency(wordFrequency.getFrequency()+ StableData.INT_ONE);
outputList.put(strings[StableData.INT_ONE], wordFrequency);
} else{
WordFrequency wordFrequency= new WordFrequency();
wordFrequency.setFrequency(StableData.INT_ONE);
wordFrequency.setWord(strings[StableData.INT_ONE]);
outputList.put(strings[StableData.INT_ONE], wordFrequency);
}
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ONE]);
countInputStringLength+= StableData.INT_TWO;
}
return countInputStringLength;
}
}
return countInputStringLength;
}
public void didNotFindFirstCharForMap(Map<String, WordFrequency> outputList, String[] strings, StringBuilder[] fixWord
, Map<String, String> wordsForest){
if(!wordsForest.containsKey(strings[StableData.INT_TWO])){
return;
}
if (StableMaps.fuCi.containsKey(strings[StableData.INT_TWO])){
if (outputList.containsKey(strings[StableData.INT_ZERO])){
WordFrequency wordFrequency= outputList.get(strings[StableData.INT_ZERO]);
wordFrequency.setFrequency(wordFrequency.getFrequency()+ StableData.INT_ONE);
outputList.put(strings[StableData.INT_ZERO], wordFrequency);
} else{
WordFrequency wordFrequency= new WordFrequency();
wordFrequency.setFrequency(StableData.INT_ONE);
wordFrequency.setWord(strings[StableData.INT_ZERO]);
outputList.put(strings[StableData.INT_ZERO], wordFrequency);
}
if (outputList.containsKey(strings[StableData.INT_TWO])){
WordFrequency wordFrequency= outputList.get(strings[StableData.INT_TWO]);
wordFrequency.setFrequency(wordFrequency.getFrequency()+ StableData.INT_ONE);
outputList.put(strings[StableData.INT_TWO], wordFrequency);
} else{
WordFrequency wordFrequency= new WordFrequency();
wordFrequency.setFrequency(StableData.INT_ONE);
wordFrequency.setWord(strings[StableData.INT_TWO]);
outputList.put(strings[StableData.INT_TWO], wordFrequency);
}
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_TWO]);
}
}
public int parserFirstCharOfThreeForMap(int countInputStringLength, Map<String, WordFrequency> outputList, String[] strings
, StringBuilder[] fixWord, Map<String, String> wordsForest){
countInputStringLength-= StableData.INT_THREE;
if (outputList.containsKey(strings[StableData.INT_ZERO])){
WordFrequency wordFrequency = outputList.get(strings[StableData.INT_ZERO]);
wordFrequency.setFrequency(wordFrequency.getFrequency()+ StableData.INT_ONE);
outputList.put(strings[StableData.INT_ZERO], wordFrequency);
} else{
WordFrequency wordFrequency= new WordFrequency();
wordFrequency.setFrequency(StableData.INT_ONE);
wordFrequency.setWord(strings[StableData.INT_ZERO]);
outputList.put(strings[StableData.INT_ZERO], wordFrequency);
}
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_ZERO]);
countInputStringLength ++;
if (wordsForest.containsKey(strings[StableData.INT_TWO])){
if (outputList.containsKey(strings[StableData.INT_TWO])){
WordFrequency wordFrequency= outputList.get(strings[StableData.INT_TWO]);
wordFrequency.setFrequency(wordFrequency.getFrequency() + StableData.INT_ONE);
outputList.put(strings[StableData.INT_TWO], wordFrequency);
} else{
WordFrequency wordFrequency= new WordFrequency();
wordFrequency.setFrequency(StableData.INT_ONE);
wordFrequency.setWord(strings[StableData.INT_TWO]);
outputList.put(strings[StableData.INT_TWO], wordFrequency);
}
fixWord[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWord[StableData.INT_ZERO].length());
fixWord[StableData.INT_ZERO].append(strings[StableData.INT_TWO]);
countInputStringLength+= StableData.INT_TWO;
return countInputStringLength;
}
return countInputStringLength;
}
}
Java
1
https://gitee.com/DetaChina/DetaParser.git
git@gitee.com:DetaChina/DetaParser.git
DetaChina
DetaParser
快速中文分词分析word segmentation
master

搜索帮助