Package games.stendhal.common.parser

Examples of games.stendhal.common.parser.ConversationParser


    assertNull(sentence.getObject(0));
    assertNull(sentence.getObjectName());
    assertFalse(sentence.hasError());

    SentenceImplementation impl = new SentenceImplementation(null, null);
    ConversationParser parser = new ConversationParser(impl);
    impl.parse(parser);
    assertNotNull(impl);
    assertEquals(0, impl.getSubjectCount());
    assertNull(impl.getSubject(0));
    assertEquals(0, impl.getVerbCount());
View Full Code Here


  @Test
  public final void testGrammar() {
    final ConversationContext ctx = new ConversationContext();

    SentenceImplementation sentence = new SentenceImplementation(ctx, "The quick brown fox jumps over the lazy dog.");
    ConversationParser parser = new ConversationParser(sentence);
    sentence.parse(parser);
    sentence.classifyWords(parser);
    assertFalse(sentence.hasError());
    assertEquals("quick/ADJ brown/ADJ-COL fox/SUB-ANI jump/VER over/PRE lazy/ADJ dog/SUB-ANI.",
        sentence.toString());

    sentence.mergeWords();
    assertEquals("quick brown fox/SUB-ANI-COL jump/VER over/PRE lazy dog/SUB-ANI.", sentence.toString());
    assertEquals(Sentence.SentenceType.STATEMENT, sentence.getType());

    sentence = new SentenceImplementation(ctx, "does it fit");
    parser = new ConversationParser(sentence);
    sentence.parse(parser);
    sentence.classifyWords(parser);
    assertFalse(sentence.hasError());
    assertEquals("do/VER it/OBJ-PRO fit/VER", sentence.toString());
    assertEquals(Sentence.SentenceType.QUESTION, sentence.evaluateSentenceType());
View Full Code Here

TOP

Related Classes of games.stendhal.common.parser.ConversationParser

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.