Package org.chasen.mecab

Examples of org.chasen.mecab.Node


    assertEquals(null, tokens);
  }
 
  @Test
  public void testPreanaysisSentence() {
    Node node = mockNodeListFactory(new String[] {
        "은전한닢\tNNG+NR+NNG,*,T,은전한닢,Preanalysis,NNG,NR,은전+한+닢,은전/NNG/*/1/1+한/NR/*/1/1+닢/NNG/*/1/1",
        "은\tJX,*,T,은,*,*,*,*,*",
        "오픈\tNNG,*,T,오픈,*,*,*,*,*",
        "소스\tNNG,*,F,소스,*,*,*,*,*",
        "이\tVCP,*,F,이,*,*,*,*,*",
 
View Full Code Here


    assertEquals(null, tokens);
  }
 
  @Test
  public void testUnknownSurface() {
    Node node = mockNodeListFactory(new String[] {
        "걀꿀\tUNKNOWN,*,*,*,*,*,*,*,*",
        " 없\tVA,*,T,없,*,*,*,*,*",
        "는\tETM,*,T,는,*,*,*,*,*",
        " 단어\tNNG,*,F,단어,*,*,*,*,*",
    });
View Full Code Here

    assertEquals(null, tokens);
  }
 
  @Test
  public void testSymbolOnlySentence() {
    Node node = mockNodeListFactory(new String[] {
        "!@#$%^&*()\tSY,*,*,*,*,*,*,*"
    });
   
    TokenGenerator generator =
        new TokenGenerator(
View Full Code Here

    assertEquals(null, tokens);
  }

  @Test
  public void testXsn() {
    Node node = mockNodeListFactory(new String[] {
        "의대\tNNG,*,F,의대,*,*,*,*,*",
        "생\tXSN,*,T,생,*,*,*,*,*",

    });

View Full Code Here

    assertEquals(null, tokens);
  }

  @Test
  public void testSentenceWithXsn() {
    Node node = mockNodeListFactory(new String[] {
        "공대\tNNG,*,F,공대,*,*,*,*,*",
        "생\tXSN,*,T,생,*,*,*,*,*",
        "은\tJX,*,T,은,*,*,*,*,*",
        " 바쁘\tVA,*,F,바쁘,*,*,*,*,*",
        "다\tEF,*,F,다,*,*,*,*,*",
 
View Full Code Here

    assertEquals(null, tokens);
  }

  @Test
  public void testXpn() {
    Node node = mockNodeListFactory(new String[] {
        "왕\tXPN,*,T,왕,*,*,*,*,*",
        "게임\tNNG,*,T,게임,*,*,*,*,*",
    });

    TokenGenerator generator =
View Full Code Here

    assertEquals(null, tokens);
  }
 
  @Test
  public void testSemanticClass() {
    Node node = mockNodeListFactory(new String[] {
        "남희석\tNNP,인명,T,남희석,*,*,*,*,*",
        "은\tJX,*,T,은,*,*,*,*,*",
        " 충남\tNNP,지명,T,충남,*,*,*,*,*",
        "사람\tNNG,*,T,사람,*,*,*,*,*",
        "이\tVCP,*,F,이,*,*,*,*,*",
 
View Full Code Here

    mecabLoader =
        MeCabLoader.getInstance("/usr/local/lib/mecab/dic/mecab-ko-dic");
  }
 
  public static Node mockNodeListFactory(String[] posStrings) {
    Node nextNode = null;
    for (int i = posStrings.length - 1; i >= 0; --i) {
      Node node = mockNodeFactory(posStrings[i], nextNode);
      nextNode = node;
    }
    return mockBeginNode(nextNode);
  }
View Full Code Here

      throw new IllegalArgumentException("Invalid POS string");
    }
    String surface = surfaceAndFeature[0].trim();
    String feature = surfaceAndFeature[1].trim();
   
    Node node = mock(Node.class);
    when(node.getSurface()).thenReturn(surface);
    when(node.getPosid()).thenReturn(getPosId(feature));
    when(node.getRlength()).thenReturn(surfaceAndFeature[0].length());
    when(node.getLength()).thenReturn(surface.length());
    when(node.getFeature()).thenReturn(feature);
    when(node.getNext()).thenReturn(next);
    return node;
  }
View Full Code Here

    when(node.getNext()).thenReturn(next);
    return node;
  }
 
  private static Node mockBeginNode(Node next) {
    Node node = mock(Node.class);
    when(node.getSurface()).thenReturn("BOS");
    when(node.getPosid()).thenReturn(0);
    when(node.getRlength()).thenReturn(0);
    when(node.getLength()).thenReturn(0);
    when(node.getFeature()).thenReturn("");
    when(node.getNext()).thenReturn(next);
    return node;
  }
View Full Code Here

TOP

Related Classes of org.chasen.mecab.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.