예제 #1
0
 @Test
 public void testLoadDictionaryAndPrintTrie() throws Exception {
   WordEntry word = Dictionary.searchNoun("괴물");
   assertEquals("괴물", word.getString());
   Dictionary.printFixedWordDictionary(new PrintWriter(new FileWriter("d:/temp/ka.txt")));
   Dictionary.printVerbDictionary(new PrintWriter(new FileWriter("d:/temp/ka_verb.txt")));
 }
예제 #2
0
  @Test
  public void testSearchPrefixedBy_Verb() throws Exception {
    String word = "거치";
    Iterator iter = Dictionary.searchVerbPrefixedBy(word);
    while (iter.hasNext()) {
      WordEntry entry = (WordEntry) iter.next();

      WordEntry dicEntry = Dictionary.search(entry.getString(), PosTag.V);
      assertEquals(dicEntry, entry);
    }
  }
예제 #3
0
 @Test
 public void testFindWithPosTag_명사() throws Exception {
   String word = "가계약";
   WordEntry entry = Dictionary.searchNoun(word);
   assertEquals(word, entry.getString());
   assertTrue(entry.isTagOf(PosTag.N));
 }
예제 #4
0
 @Test
 public void testGetPrefixedBy() throws Exception {
   // String[] expected = {"포르노", "포르르", "포르말린", "포르볼","포르노그라피"};
   List<String> candidates = new ArrayList<String>();
   Iterator iter = Dictionary.searchPrefixedBy("포르");
   assertNotNull(iter);
   while (iter.hasNext()) {
     WordEntry entry = (WordEntry) iter.next();
     System.out.println(entry.getString());
     candidates.add(entry.getString());
   }
   assertEquals(26, candidates.size());
 }
예제 #5
0
 @Test
 public void testSearch_접미사() throws Exception {
   for (WordEntry each : suffixes) {
     assertEquals(each.getString(), Dictionary.searchSuffix(each.getString()).getString());
   }
 }
예제 #6
0
 @Test
 public void testSearch_어미() throws Exception {
   for (WordEntry each : eomis) {
     assertEquals(each.getString(), Dictionary.searchEomi(each.getString()).getString());
   }
 }
예제 #7
0
 @Test
 public void testSearch_조사() throws Exception {
   for (WordEntry each : josas) {
     assertEquals(each.getString(), Dictionary.searchJosa(each.getString()).getString());
   }
 }
예제 #8
0
 @Test
 public void testSearchVerb() throws Exception {
   String word = "거칠";
   assertEquals(word, Dictionary.searchVerb(word).getString());
   assertEquals(PosTag.VA, Dictionary.searchVerb(word).tag());
 }
예제 #9
0
 @Test
 public void testFindNounOrAdverb() throws Exception {
   String word = "가급적";
   assertEquals(word, Dictionary.searchNounOrAbVerb(word).getString());
 }