Package org.languagetool.chunking

Examples of org.languagetool.chunking.ChunkTag


    final PatternRule demoRuleWithChunk = (PatternRule) getRuleById("DEMO_CHUNK_RULE", rules);
    final List<Element> elements = demoRuleWithChunk.getElements();
    assertEquals(2, elements.size());
    assertEquals(null, elements.get(1).getPOStag());
    assertEquals(new ChunkTag("B-NP-singular"), elements.get(1).getChunkTag());

    final List<Rule> orRules = getRulesById("GROUP_WITH_URL", rules);
    assertEquals(3, orRules.size());
    assertEquals("http://fake-server.org/rule-group-url", orRules.get(0).getUrl().toString());
    assertEquals("http://fake-server.org/rule-group-url-overwrite", orRules.get(1).getUrl().toString());
View Full Code Here


  }

  @Test
  public void testTestAllReadingsWithChunks() throws Exception {
    Element chunkElement = new Element(null, false, false, false);
    chunkElement.setChunkElement(new ChunkTag("myChunk"));
    PatternRule simpleRule = new PatternRule("FAKE", new Demo(), Collections.singletonList(chunkElement), "descr", "message", "short");
    ElementMatcher elemMatcher = new ElementMatcher(chunkElement);

    AbstractPatternRulePerformer p = new MockAbstractPatternRulePerformer(simpleRule, null);
View Full Code Here

  }

  private AnalyzedTokenReadings[] tokenReadings(String token, String chunkTag) {
    AnalyzedTokenReadings tokenReadings1 = new AnalyzedTokenReadings(new AnalyzedToken(token, "pos", "lemma"), 0);
    if (chunkTag != null) {
      tokenReadings1.setChunkTags(Collections.singletonList(new ChunkTag(chunkTag)));
    }
    return new AnalyzedTokenReadings[] { tokenReadings1 };
  }
View Full Code Here

  @Override
  public void addChunkTags(List<AnalyzedTokenReadings> tokenReadings) {
    for (AnalyzedTokenReadings tokenReading : tokenReadings) {
      if ("chunkbar".equals(tokenReading.getToken())) {
        tokenReading.setChunkTags(Collections.singletonList(new ChunkTag("B-NP-singular")));
      }
    }
  }
View Full Code Here

      posToken = attrs.getValue(POSTAG);
      posRegExp = YES.equals(attrs.getValue(POSTAG_REGEXP));
      posNegation = YES.equals(attrs.getValue(NEGATE_POS));
    }
    if (attrs.getValue(CHUNKTAG) != null) {
      chunkTag = new ChunkTag(attrs.getValue(CHUNKTAG));
    }
    regExpression = YES.equals(attrs.getValue(REGEXP));

    if (attrs.getValue(SPACEBEFORE) != null) {
      tokenSpaceBefore = YES.equals(attrs.getValue(SPACEBEFORE));
View Full Code Here

TOP

Related Classes of org.languagetool.chunking.ChunkTag

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.