@Test public void testParserMixedString() { fail("Not yet implemented"); }
public List<String> parserMixedString(String mixedString) { mixedString+= StableData.SPACE_STRING_DISTINCTION; int inputStringLength= mixedString.length(); List<String> outputList = new LinkedList<>(); 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(mixedString.charAt(charPosition) < StableData.INT_TEN_SOUTHANDS && charPosition < inputStringLength - StableData.INT_ONE){ if(find == StableData.INT_ZERO) { fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); } fixWords[StableData.INT_ZERO].append(mixedString.charAt(charPosition)); countInputStringLength = StableData.INT_ONE; find = StableData.INT_ONE; continue Here; } if(StableData.INT_ONE == find) { find = StableData.INT_ZERO; Iterator<String> it = fHMMList.englishStringToWordsList(fixWords[StableData.INT_ZERO].toString()).iterator(); StringBuilder number= new StringBuilder(); while(it.hasNext()) { String temp = it.next(); if(StableData.NUMBERS.contains(temp)) { number.append(temp); }else { if(number.length()>0) { outputList.add(number.toString()); number.delete(0, number.length()); } outputList.add(temp); } } if(number.length()>0) { outputList.add(number.toString()); number.delete(0, number.length()); } fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); } stringBuilder.delete(StableData.INT_ZERO, stringBuilder.length()); stringBuilder = neroController.getBinaryForestRecurWordOneTime(stringBuilder.append(mixedString .charAt(charPosition)), mixedString, charPosition, inputStringLength, forestRoots, forestDepth , charPosition + StableData.INT_ONE); String countWordNode = stringBuilder.toString(); int compare = countInputStringLength = countWordNode.length(); if (StableData.INT_ONE == compare) { outputList.add(countWordNode); fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); fixWords[StableData.INT_ZERO].append(countWordNode); continue Here; } if (StableData.INT_TWO == compare) { countInputStringLength = nlpController.doSlangPartAndPOSCheckForTwoChar(countInputStringLength, outputList , stringBuilder, wordsForest, fixWords, posController, charPosition, mixedString); continue Here; } if (StableData.INT_THREE == compare) { addFixWords(charPosition, mixedString, fixWords); countInputStringLength = nlpController.doPOSAndEMMCheckOfThree(countInputStringLength, outputList , wordsForest, stringBuilder, fixWords, posController, charPosition, mixedString); continue Here; } if (StableData.INT_FOUR == compare) { addFixWords(charPosition, mixedString, fixWords); countInputStringLength = nlpController.doSlangCheck(countInputStringLength, outputList, stringBuilder , wordsForest, fixWords, posController, charPosition, mixedString); } } return outputList; }
AnalyzerImp implements Analyzer { public List<String> parserMixedString(String mixedString) { mixedString+= StableData.SPACE_STRING_DISTINCTION; int inputStringLength= mixedString.length(); List<String> outputList = new LinkedList<>(); 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(mixedString.charAt(charPosition) < StableData.INT_TEN_SOUTHANDS && charPosition < inputStringLength - StableData.INT_ONE){ if(find == StableData.INT_ZERO) { fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); } fixWords[StableData.INT_ZERO].append(mixedString.charAt(charPosition)); countInputStringLength = StableData.INT_ONE; find = StableData.INT_ONE; continue Here; } if(StableData.INT_ONE == find) { find = StableData.INT_ZERO; Iterator<String> it = fHMMList.englishStringToWordsList(fixWords[StableData.INT_ZERO].toString()).iterator(); StringBuilder number= new StringBuilder(); while(it.hasNext()) { String temp = it.next(); if(StableData.NUMBERS.contains(temp)) { number.append(temp); }else { if(number.length()>0) { outputList.add(number.toString()); number.delete(0, number.length()); } outputList.add(temp); } } if(number.length()>0) { outputList.add(number.toString()); number.delete(0, number.length()); } fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); } stringBuilder.delete(StableData.INT_ZERO, stringBuilder.length()); stringBuilder = neroController.getBinaryForestRecurWordOneTime(stringBuilder.append(mixedString .charAt(charPosition)), mixedString, charPosition, inputStringLength, forestRoots, forestDepth , charPosition + StableData.INT_ONE); String countWordNode = stringBuilder.toString(); int compare = countInputStringLength = countWordNode.length(); if (StableData.INT_ONE == compare) { outputList.add(countWordNode); fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); fixWords[StableData.INT_ZERO].append(countWordNode); continue Here; } if (StableData.INT_TWO == compare) { countInputStringLength = nlpController.doSlangPartAndPOSCheckForTwoChar(countInputStringLength, outputList , stringBuilder, wordsForest, fixWords, posController, charPosition, mixedString); continue Here; } if (StableData.INT_THREE == compare) { addFixWords(charPosition, mixedString, fixWords); countInputStringLength = nlpController.doPOSAndEMMCheckOfThree(countInputStringLength, outputList , wordsForest, stringBuilder, fixWords, posController, charPosition, mixedString); continue Here; } if (StableData.INT_FOUR == compare) { addFixWords(charPosition, mixedString, fixWords); countInputStringLength = nlpController.doSlangCheck(countInputStringLength, outputList, stringBuilder , wordsForest, fixWords, posController, charPosition, mixedString); } } return outputList; } }
AnalyzerImp implements Analyzer { public List<String> parserMixedString(String mixedString) { mixedString+= StableData.SPACE_STRING_DISTINCTION; int inputStringLength= mixedString.length(); List<String> outputList = new LinkedList<>(); 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(mixedString.charAt(charPosition) < StableData.INT_TEN_SOUTHANDS && charPosition < inputStringLength - StableData.INT_ONE){ if(find == StableData.INT_ZERO) { fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); } fixWords[StableData.INT_ZERO].append(mixedString.charAt(charPosition)); countInputStringLength = StableData.INT_ONE; find = StableData.INT_ONE; continue Here; } if(StableData.INT_ONE == find) { find = StableData.INT_ZERO; Iterator<String> it = fHMMList.englishStringToWordsList(fixWords[StableData.INT_ZERO].toString()).iterator(); StringBuilder number= new StringBuilder(); while(it.hasNext()) { String temp = it.next(); if(StableData.NUMBERS.contains(temp)) { number.append(temp); }else { if(number.length()>0) { outputList.add(number.toString()); number.delete(0, number.length()); } outputList.add(temp); } } if(number.length()>0) { outputList.add(number.toString()); number.delete(0, number.length()); } fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); } stringBuilder.delete(StableData.INT_ZERO, stringBuilder.length()); stringBuilder = neroController.getBinaryForestRecurWordOneTime(stringBuilder.append(mixedString .charAt(charPosition)), mixedString, charPosition, inputStringLength, forestRoots, forestDepth , charPosition + StableData.INT_ONE); String countWordNode = stringBuilder.toString(); int compare = countInputStringLength = countWordNode.length(); if (StableData.INT_ONE == compare) { outputList.add(countWordNode); fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); fixWords[StableData.INT_ZERO].append(countWordNode); continue Here; } if (StableData.INT_TWO == compare) { countInputStringLength = nlpController.doSlangPartAndPOSCheckForTwoChar(countInputStringLength, outputList , stringBuilder, wordsForest, fixWords, posController, charPosition, mixedString); continue Here; } if (StableData.INT_THREE == compare) { addFixWords(charPosition, mixedString, fixWords); countInputStringLength = nlpController.doPOSAndEMMCheckOfThree(countInputStringLength, outputList , wordsForest, stringBuilder, fixWords, posController, charPosition, mixedString); continue Here; } if (StableData.INT_FOUR == compare) { addFixWords(charPosition, mixedString, fixWords); countInputStringLength = nlpController.doSlangCheck(countInputStringLength, outputList, stringBuilder , wordsForest, fixWords, posController, charPosition, mixedString); } } return outputList; }  }
AnalyzerImp implements Analyzer { public List<String> parserMixedString(String mixedString) { mixedString+= StableData.SPACE_STRING_DISTINCTION; int inputStringLength= mixedString.length(); List<String> outputList = new LinkedList<>(); 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(mixedString.charAt(charPosition) < StableData.INT_TEN_SOUTHANDS && charPosition < inputStringLength - StableData.INT_ONE){ if(find == StableData.INT_ZERO) { fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); } fixWords[StableData.INT_ZERO].append(mixedString.charAt(charPosition)); countInputStringLength = StableData.INT_ONE; find = StableData.INT_ONE; continue Here; } if(StableData.INT_ONE == find) { find = StableData.INT_ZERO; Iterator<String> it = fHMMList.englishStringToWordsList(fixWords[StableData.INT_ZERO].toString()).iterator(); StringBuilder number= new StringBuilder(); while(it.hasNext()) { String temp = it.next(); if(StableData.NUMBERS.contains(temp)) { number.append(temp); }else { if(number.length()>0) { outputList.add(number.toString()); number.delete(0, number.length()); } outputList.add(temp); } } if(number.length()>0) { outputList.add(number.toString()); number.delete(0, number.length()); } fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); } stringBuilder.delete(StableData.INT_ZERO, stringBuilder.length()); stringBuilder = neroController.getBinaryForestRecurWordOneTime(stringBuilder.append(mixedString .charAt(charPosition)), mixedString, charPosition, inputStringLength, forestRoots, forestDepth , charPosition + StableData.INT_ONE); String countWordNode = stringBuilder.toString(); int compare = countInputStringLength = countWordNode.length(); if (StableData.INT_ONE == compare) { outputList.add(countWordNode); fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); fixWords[StableData.INT_ZERO].append(countWordNode); continue Here; } if (StableData.INT_TWO == compare) { countInputStringLength = nlpController.doSlangPartAndPOSCheckForTwoChar(countInputStringLength, outputList , stringBuilder, wordsForest, fixWords, posController, charPosition, mixedString); continue Here; } if (StableData.INT_THREE == compare) { addFixWords(charPosition, mixedString, fixWords); countInputStringLength = nlpController.doPOSAndEMMCheckOfThree(countInputStringLength, outputList , wordsForest, stringBuilder, fixWords, posController, charPosition, mixedString); continue Here; } if (StableData.INT_FOUR == compare) { addFixWords(charPosition, mixedString, fixWords); countInputStringLength = nlpController.doSlangCheck(countInputStringLength, outputList, stringBuilder , wordsForest, fixWords, posController, charPosition, mixedString); } } 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 List<String> parserMixedString(String mixedString) { mixedString+= StableData.SPACE_STRING_DISTINCTION; int inputStringLength= mixedString.length(); List<String> outputList = new LinkedList<>(); 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(mixedString.charAt(charPosition) < StableData.INT_TEN_SOUTHANDS && charPosition < inputStringLength - StableData.INT_ONE){ if(find == StableData.INT_ZERO) { fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); } fixWords[StableData.INT_ZERO].append(mixedString.charAt(charPosition)); countInputStringLength = StableData.INT_ONE; find = StableData.INT_ONE; continue Here; } if(StableData.INT_ONE == find) { find = StableData.INT_ZERO; Iterator<String> it = fHMMList.englishStringToWordsList(fixWords[StableData.INT_ZERO].toString()).iterator(); StringBuilder number= new StringBuilder(); while(it.hasNext()) { String temp = it.next(); if(StableData.NUMBERS.contains(temp)) { number.append(temp); }else { if(number.length()>0) { outputList.add(number.toString()); number.delete(0, number.length()); } outputList.add(temp); } } if(number.length()>0) { outputList.add(number.toString()); number.delete(0, number.length()); } fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); } stringBuilder.delete(StableData.INT_ZERO, stringBuilder.length()); stringBuilder = neroController.getBinaryForestRecurWordOneTime(stringBuilder.append(mixedString .charAt(charPosition)), mixedString, charPosition, inputStringLength, forestRoots, forestDepth , charPosition + StableData.INT_ONE); String countWordNode = stringBuilder.toString(); int compare = countInputStringLength = countWordNode.length(); if (StableData.INT_ONE == compare) { outputList.add(countWordNode); fixWords[StableData.INT_ZERO].delete(StableData.INT_ZERO, fixWords[StableData.INT_ZERO].length()); fixWords[StableData.INT_ZERO].append(countWordNode); continue Here; } if (StableData.INT_TWO == compare) { countInputStringLength = nlpController.doSlangPartAndPOSCheckForTwoChar(countInputStringLength, outputList , stringBuilder, wordsForest, fixWords, posController, charPosition, mixedString); continue Here; } if (StableData.INT_THREE == compare) { addFixWords(charPosition, mixedString, fixWords); countInputStringLength = nlpController.doPOSAndEMMCheckOfThree(countInputStringLength, outputList , wordsForest, stringBuilder, fixWords, posController, charPosition, mixedString); continue Here; } if (StableData.INT_FOUR == compare) { addFixWords(charPosition, mixedString, fixWords); countInputStringLength = nlpController.doSlangCheck(countInputStringLength, outputList, stringBuilder , wordsForest, fixWords, posController, charPosition, mixedString); } } 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();  }