@Test public void testParserStringByReturnFrequencyMap() { fail("Not yet implemented"); }
public Map<String, WordFrequency> parserStringByReturnFrequencyMap(String inputString) { Map<String, String> wordsForest = fHMMList.getPosCnToCn(); Map<String, WordFrequency> outputList = new ConcurrentHashMap<>(); Map<Long, FMHMMNode> forestRoots = fHMMList.getMap(); int inputStringLength = inputString.length(); int forestDepth = StableData.INT_ZERO; int countInputStringLength; StringBuilder[] fixWords = new StringBuilder[StableData.INT_TWO]; fixWords[StableData.INT_ZERO] = new StringBuilder(); fixWords[StableData.INT_ONE] = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder(); int find = StableData.INT_ZERO; Here: for (int charPosition= StableData.INT_ZERO; charPosition< inputStringLength; charPosition += (countInputStringLength== StableData.INT_ZERO? StableData.INT_ONE: countInputStringLength)) { if(inputString.charAt(charPosition)< StableData.INT_ONE_TWO_EIGHT){ if(fixWords[StableData.INT_ZERO].length()> StableData.INT_ZERO) { if(fixWords[StableData.INT_ZERO].charAt(fixWords[StableData.INT_ZERO].length()- StableData.INT_ONE) < StableData.INT_ONE_TWO_EIGHT) { fixWords[StableData.INT_ZERO].append(inputString.charAt(charPosition)); countInputStringLength= StableData.INT_ONE; find = StableData.INT_ONE; continue Here; } fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); } find=StableData.INT_ONE; fixWords[StableData.INT_ZERO].append(inputString.charAt(charPosition)); countInputStringLength = StableData.INT_ONE; continue Here; } if(find == StableData.INT_ONE) { find = StableData.INT_ZERO; WordFrequencyUtil.WordFrequencyFindCheck(outputList, fixWords); } stringBuilder.delete(StableData.INT_ZERO, stringBuilder.length()); stringBuilder = neroController.getBinaryForestRecurWordOneTime(stringBuilder.append(inputString .charAt(charPosition)), inputString, charPosition, inputStringLength, forestRoots, forestDepth , charPosition + StableData.INT_ONE); String countWordNode = stringBuilder.toString(); int compare = countInputStringLength = countWordNode.length(); if (compare == StableData.INT_ONE) { WordFrequencyUtil.WordFrequencyCompareCheck(outputList, fixWords, countWordNode); fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); fixWords[StableData.INT_ZERO].append(countWordNode); continue Here; } if (compare == StableData.INT_TWO) { countInputStringLength = nlpController.doSlangPartAndPOSCheckForTwoCharForMap(countInputStringLength , outputList, stringBuilder, wordsForest, fixWords, posController); continue Here; } if (compare == StableData.INT_THREE) { addFixWords(charPosition, inputString, fixWords); countInputStringLength = nlpController.doPOSAndEMMCheckOfThreeForMap(countInputStringLength, outputList , wordsForest, stringBuilder, fixWords, posController); continue Here; } if (compare == StableData.INT_FOUR) { addFixWords(charPosition, inputString, fixWords); countInputStringLength = nlpController.doSlangCheckForMap(countInputStringLength, outputList, stringBuilder , wordsForest, fixWords, posController); } } return outputList; }
AnalyzerImp implements Analyzer { public Map<String, WordFrequency> parserStringByReturnFrequencyMap(String inputString) { Map<String, String> wordsForest = fHMMList.getPosCnToCn(); Map<String, WordFrequency> outputList = new ConcurrentHashMap<>(); Map<Long, FMHMMNode> forestRoots = fHMMList.getMap(); int inputStringLength = inputString.length(); int forestDepth = StableData.INT_ZERO; int countInputStringLength; StringBuilder[] fixWords = new StringBuilder[StableData.INT_TWO]; fixWords[StableData.INT_ZERO] = new StringBuilder(); fixWords[StableData.INT_ONE] = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder(); int find = StableData.INT_ZERO; Here: for (int charPosition= StableData.INT_ZERO; charPosition< inputStringLength; charPosition += (countInputStringLength== StableData.INT_ZERO? StableData.INT_ONE: countInputStringLength)) { if(inputString.charAt(charPosition)< StableData.INT_ONE_TWO_EIGHT){ if(fixWords[StableData.INT_ZERO].length()> StableData.INT_ZERO) { if(fixWords[StableData.INT_ZERO].charAt(fixWords[StableData.INT_ZERO].length()- StableData.INT_ONE) < StableData.INT_ONE_TWO_EIGHT) { fixWords[StableData.INT_ZERO].append(inputString.charAt(charPosition)); countInputStringLength= StableData.INT_ONE; find = StableData.INT_ONE; continue Here; } fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); } find=StableData.INT_ONE; fixWords[StableData.INT_ZERO].append(inputString.charAt(charPosition)); countInputStringLength = StableData.INT_ONE; continue Here; } if(find == StableData.INT_ONE) { find = StableData.INT_ZERO; WordFrequencyUtil.WordFrequencyFindCheck(outputList, fixWords); } stringBuilder.delete(StableData.INT_ZERO, stringBuilder.length()); stringBuilder = neroController.getBinaryForestRecurWordOneTime(stringBuilder.append(inputString .charAt(charPosition)), inputString, charPosition, inputStringLength, forestRoots, forestDepth , charPosition + StableData.INT_ONE); String countWordNode = stringBuilder.toString(); int compare = countInputStringLength = countWordNode.length(); if (compare == StableData.INT_ONE) { WordFrequencyUtil.WordFrequencyCompareCheck(outputList, fixWords, countWordNode); fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); fixWords[StableData.INT_ZERO].append(countWordNode); continue Here; } if (compare == StableData.INT_TWO) { countInputStringLength = nlpController.doSlangPartAndPOSCheckForTwoCharForMap(countInputStringLength , outputList, stringBuilder, wordsForest, fixWords, posController); continue Here; } if (compare == StableData.INT_THREE) { addFixWords(charPosition, inputString, fixWords); countInputStringLength = nlpController.doPOSAndEMMCheckOfThreeForMap(countInputStringLength, outputList , wordsForest, stringBuilder, fixWords, posController); continue Here; } if (compare == StableData.INT_FOUR) { addFixWords(charPosition, inputString, fixWords); countInputStringLength = nlpController.doSlangCheckForMap(countInputStringLength, outputList, stringBuilder , wordsForest, fixWords, posController); } } return outputList; } }
AnalyzerImp implements Analyzer { public Map<String, WordFrequency> parserStringByReturnFrequencyMap(String inputString) { Map<String, String> wordsForest = fHMMList.getPosCnToCn(); Map<String, WordFrequency> outputList = new ConcurrentHashMap<>(); Map<Long, FMHMMNode> forestRoots = fHMMList.getMap(); int inputStringLength = inputString.length(); int forestDepth = StableData.INT_ZERO; int countInputStringLength; StringBuilder[] fixWords = new StringBuilder[StableData.INT_TWO]; fixWords[StableData.INT_ZERO] = new StringBuilder(); fixWords[StableData.INT_ONE] = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder(); int find = StableData.INT_ZERO; Here: for (int charPosition= StableData.INT_ZERO; charPosition< inputStringLength; charPosition += (countInputStringLength== StableData.INT_ZERO? StableData.INT_ONE: countInputStringLength)) { if(inputString.charAt(charPosition)< StableData.INT_ONE_TWO_EIGHT){ if(fixWords[StableData.INT_ZERO].length()> StableData.INT_ZERO) { if(fixWords[StableData.INT_ZERO].charAt(fixWords[StableData.INT_ZERO].length()- StableData.INT_ONE) < StableData.INT_ONE_TWO_EIGHT) { fixWords[StableData.INT_ZERO].append(inputString.charAt(charPosition)); countInputStringLength= StableData.INT_ONE; find = StableData.INT_ONE; continue Here; } fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); } find=StableData.INT_ONE; fixWords[StableData.INT_ZERO].append(inputString.charAt(charPosition)); countInputStringLength = StableData.INT_ONE; continue Here; } if(find == StableData.INT_ONE) { find = StableData.INT_ZERO; WordFrequencyUtil.WordFrequencyFindCheck(outputList, fixWords); } stringBuilder.delete(StableData.INT_ZERO, stringBuilder.length()); stringBuilder = neroController.getBinaryForestRecurWordOneTime(stringBuilder.append(inputString .charAt(charPosition)), inputString, charPosition, inputStringLength, forestRoots, forestDepth , charPosition + StableData.INT_ONE); String countWordNode = stringBuilder.toString(); int compare = countInputStringLength = countWordNode.length(); if (compare == StableData.INT_ONE) { WordFrequencyUtil.WordFrequencyCompareCheck(outputList, fixWords, countWordNode); fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); fixWords[StableData.INT_ZERO].append(countWordNode); continue Here; } if (compare == StableData.INT_TWO) { countInputStringLength = nlpController.doSlangPartAndPOSCheckForTwoCharForMap(countInputStringLength , outputList, stringBuilder, wordsForest, fixWords, posController); continue Here; } if (compare == StableData.INT_THREE) { addFixWords(charPosition, inputString, fixWords); countInputStringLength = nlpController.doPOSAndEMMCheckOfThreeForMap(countInputStringLength, outputList , wordsForest, stringBuilder, fixWords, posController); continue Here; } if (compare == StableData.INT_FOUR) { addFixWords(charPosition, inputString, fixWords); countInputStringLength = nlpController.doSlangCheckForMap(countInputStringLength, outputList, stringBuilder , wordsForest, fixWords, posController); } } return outputList; }  }
AnalyzerImp implements Analyzer { public Map<String, WordFrequency> parserStringByReturnFrequencyMap(String inputString) { Map<String, String> wordsForest = fHMMList.getPosCnToCn(); Map<String, WordFrequency> outputList = new ConcurrentHashMap<>(); Map<Long, FMHMMNode> forestRoots = fHMMList.getMap(); int inputStringLength = inputString.length(); int forestDepth = StableData.INT_ZERO; int countInputStringLength; StringBuilder[] fixWords = new StringBuilder[StableData.INT_TWO]; fixWords[StableData.INT_ZERO] = new StringBuilder(); fixWords[StableData.INT_ONE] = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder(); int find = StableData.INT_ZERO; Here: for (int charPosition= StableData.INT_ZERO; charPosition< inputStringLength; charPosition += (countInputStringLength== StableData.INT_ZERO? StableData.INT_ONE: countInputStringLength)) { if(inputString.charAt(charPosition)< StableData.INT_ONE_TWO_EIGHT){ if(fixWords[StableData.INT_ZERO].length()> StableData.INT_ZERO) { if(fixWords[StableData.INT_ZERO].charAt(fixWords[StableData.INT_ZERO].length()- StableData.INT_ONE) < StableData.INT_ONE_TWO_EIGHT) { fixWords[StableData.INT_ZERO].append(inputString.charAt(charPosition)); countInputStringLength= StableData.INT_ONE; find = StableData.INT_ONE; continue Here; } fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); } find=StableData.INT_ONE; fixWords[StableData.INT_ZERO].append(inputString.charAt(charPosition)); countInputStringLength = StableData.INT_ONE; continue Here; } if(find == StableData.INT_ONE) { find = StableData.INT_ZERO; WordFrequencyUtil.WordFrequencyFindCheck(outputList, fixWords); } stringBuilder.delete(StableData.INT_ZERO, stringBuilder.length()); stringBuilder = neroController.getBinaryForestRecurWordOneTime(stringBuilder.append(inputString .charAt(charPosition)), inputString, charPosition, inputStringLength, forestRoots, forestDepth , charPosition + StableData.INT_ONE); String countWordNode = stringBuilder.toString(); int compare = countInputStringLength = countWordNode.length(); if (compare == StableData.INT_ONE) { WordFrequencyUtil.WordFrequencyCompareCheck(outputList, fixWords, countWordNode); fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); fixWords[StableData.INT_ZERO].append(countWordNode); continue Here; } if (compare == StableData.INT_TWO) { countInputStringLength = nlpController.doSlangPartAndPOSCheckForTwoCharForMap(countInputStringLength , outputList, stringBuilder, wordsForest, fixWords, posController); continue Here; } if (compare == StableData.INT_THREE) { addFixWords(charPosition, inputString, fixWords); countInputStringLength = nlpController.doPOSAndEMMCheckOfThreeForMap(countInputStringLength, outputList , wordsForest, stringBuilder, fixWords, posController); continue Here; } if (compare == StableData.INT_FOUR) { addFixWords(charPosition, inputString, fixWords); countInputStringLength = nlpController.doSlangCheckForMap(countInputStringLength, outputList, stringBuilder , wordsForest, fixWords, posController); } } return outputList; }  void init(); void initMixed(); List<String> parserMixedString(String mixedString); List<String> parserString(String inputString); Map<String, WordFrequency> parserStringByReturnFrequencyMap(String inputString); void addFixWords(int charPosition, String inputString, StringBuilder[] fixWords); Map<String, String> getEnToCn(); Map<String, String> getCnToEn(); Map<String, WordFrequency> getWordFrequencyMap(List<String> sets); List<WordFrequency> sortWordFrequencyMap(Map<String, WordFrequency> map); List<WordFrequency> getWordFrequency(List<String> sets); Map<Integer, WordFrequency> getWordFrequencyByReturnSortMap(List<String> sets); Map<Integer, WordFrequency> sortWordFrequencyMapToUnsortMap(Map<String, WordFrequency> map); Map<Integer, WordFrequency> sortWordFrequencyMapToSortMap(Map<String, WordFrequency> map); String[] parserEnglishString(String englishString); Map<String, String> getPosEnToCn(); Map<String, String> getPosEnToEn(); Map<String, String> getPosCnToCn(); Map<String, String> getFullEnToCn(); Map<String, String> getFullCnToEn(); Map<String, WordFrequency> parserMixStringByReturnFrequencyMap(String mixedString); void studyNewWord(String study, String token, String posStudy); @Override Map<String, String> getStudyPos(); }
AnalyzerImp implements Analyzer { public Map<String, WordFrequency> parserStringByReturnFrequencyMap(String inputString) { Map<String, String> wordsForest = fHMMList.getPosCnToCn(); Map<String, WordFrequency> outputList = new ConcurrentHashMap<>(); Map<Long, FMHMMNode> forestRoots = fHMMList.getMap(); int inputStringLength = inputString.length(); int forestDepth = StableData.INT_ZERO; int countInputStringLength; StringBuilder[] fixWords = new StringBuilder[StableData.INT_TWO]; fixWords[StableData.INT_ZERO] = new StringBuilder(); fixWords[StableData.INT_ONE] = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder(); int find = StableData.INT_ZERO; Here: for (int charPosition= StableData.INT_ZERO; charPosition< inputStringLength; charPosition += (countInputStringLength== StableData.INT_ZERO? StableData.INT_ONE: countInputStringLength)) { if(inputString.charAt(charPosition)< StableData.INT_ONE_TWO_EIGHT){ if(fixWords[StableData.INT_ZERO].length()> StableData.INT_ZERO) { if(fixWords[StableData.INT_ZERO].charAt(fixWords[StableData.INT_ZERO].length()- StableData.INT_ONE) < StableData.INT_ONE_TWO_EIGHT) { fixWords[StableData.INT_ZERO].append(inputString.charAt(charPosition)); countInputStringLength= StableData.INT_ONE; find = StableData.INT_ONE; continue Here; } fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); } find=StableData.INT_ONE; fixWords[StableData.INT_ZERO].append(inputString.charAt(charPosition)); countInputStringLength = StableData.INT_ONE; continue Here; } if(find == StableData.INT_ONE) { find = StableData.INT_ZERO; WordFrequencyUtil.WordFrequencyFindCheck(outputList, fixWords); } stringBuilder.delete(StableData.INT_ZERO, stringBuilder.length()); stringBuilder = neroController.getBinaryForestRecurWordOneTime(stringBuilder.append(inputString .charAt(charPosition)), inputString, charPosition, inputStringLength, forestRoots, forestDepth , charPosition + StableData.INT_ONE); String countWordNode = stringBuilder.toString(); int compare = countInputStringLength = countWordNode.length(); if (compare == StableData.INT_ONE) { WordFrequencyUtil.WordFrequencyCompareCheck(outputList, fixWords, countWordNode); fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); fixWords[StableData.INT_ZERO].append(countWordNode); continue Here; } if (compare == StableData.INT_TWO) { countInputStringLength = nlpController.doSlangPartAndPOSCheckForTwoCharForMap(countInputStringLength , outputList, stringBuilder, wordsForest, fixWords, posController); continue Here; } if (compare == StableData.INT_THREE) { addFixWords(charPosition, inputString, fixWords); countInputStringLength = nlpController.doPOSAndEMMCheckOfThreeForMap(countInputStringLength, outputList , wordsForest, stringBuilder, fixWords, posController); continue Here; } if (compare == StableData.INT_FOUR) { addFixWords(charPosition, inputString, fixWords); countInputStringLength = nlpController.doSlangCheckForMap(countInputStringLength, outputList, stringBuilder , wordsForest, fixWords, posController); } } return outputList; }  void init(); void initMixed(); List<String> parserMixedString(String mixedString); List<String> parserString(String inputString); Map<String, WordFrequency> parserStringByReturnFrequencyMap(String inputString); void addFixWords(int charPosition, String inputString, StringBuilder[] fixWords); Map<String, String> getEnToCn(); Map<String, String> getCnToEn(); Map<String, WordFrequency> getWordFrequencyMap(List<String> sets); List<WordFrequency> sortWordFrequencyMap(Map<String, WordFrequency> map); List<WordFrequency> getWordFrequency(List<String> sets); Map<Integer, WordFrequency> getWordFrequencyByReturnSortMap(List<String> sets); Map<Integer, WordFrequency> sortWordFrequencyMapToUnsortMap(Map<String, WordFrequency> map); Map<Integer, WordFrequency> sortWordFrequencyMapToSortMap(Map<String, WordFrequency> map); String[] parserEnglishString(String englishString); Map<String, String> getPosEnToCn(); Map<String, String> getPosEnToEn(); Map<String, String> getPosCnToCn(); Map<String, String> getFullEnToCn(); Map<String, String> getFullCnToEn(); Map<String, WordFrequency> parserMixStringByReturnFrequencyMap(String mixedString); void studyNewWord(String study, String token, String posStudy); @Override Map<String, String> getStudyPos();  }