Komoran implements Cloneable { public void setFWDic(String filename) { try { CorpusParser corpusParser = new CorpusParser(); BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(filename), StandardCharsets.UTF_8)); String line; this.fwd = new HashMap<>(); while ((line = br.readLine()) != null) { String[] tmp = line.split("\t"); if (tmp.length != 2 || tmp[0].charAt(0) == '#') { continue; } ProblemAnswerPair problemAnswerPair = corpusParser.parse(line); List<Pair<String, String>> convertAnswerList = new ArrayList<>(); for (Pair<String, String> pair : problemAnswerPair.getAnswerList()) { convertAnswerList.add( new Pair<>(pair.getFirst(), pair.getSecond())); } this.fwd.put(this.unitParser.parse(problemAnswerPair.getProblem()), convertAnswerList); } br.close(); } catch (Exception e) { e.printStackTrace(); } } Komoran(String modelPath);  Komoran(DEFAULT_MODEL modelType); void analyzeTextFile(String inputFilename, String outputFilename, int thread); List<KomoranResult> analyze(List<String> sentences, int thread); KomoranResult analyze(String sentence); double scoreDebug(List<String> analyzeResultList, List<String> analyzePosList); List<KomoranResult> analyze(String sentence, int nbest); void setFWDic(String filename); void setUserDic(String userDic);  }
@Test public void setFWDic() { KomoranResult komoranResult = this.komoran.analyze("감기는"); System.out.println(komoranResult.getTokenList()); this.komoran.setFWDic("user_data/fwd.user"); this.komoran.analyze("감사합니다! 바람과 함께 사라지다는 진짜 재밌었어요! nice good!"); komoranResult = this.komoran.analyze("감기는"); System.out.println(komoranResult.getTokenList()); }