Package org.languagetool

Examples of org.languagetool.AnalyzedToken


    final List<AnalyzedTokenReadings> tokenReadings = new ArrayList<>();
    int pos = 0;

    for (String word : sentenceTokens) {
      final List<AnalyzedToken> l = new ArrayList<>();
      AnalyzedToken at = asAnalyzedToken(word);
      l.add(at);
      tokenReadings.add(new AnalyzedTokenReadings(l, pos));
      pos += at.getToken().length();
    }

    return tokenReadings;
  }
View Full Code Here


    return tokenReadings;
  }

  @Override
  public final AnalyzedTokenReadings createNullToken(final String token, final int startPos) {
    return new AnalyzedTokenReadings(new AnalyzedToken(token, null, null), startPos);
  }
View Full Code Here

    return new AnalyzedTokenReadings(new AnalyzedToken(token, null, null), startPos);
  }

  @Override
  public AnalyzedToken createToken(String token, String posTag) {
    return new AnalyzedToken(token, posTag, null);
  }
View Full Code Here

  }

  private AnalyzedToken asAnalyzedToken(final String word) {
    String[] parts = word.split(" ");
    if (parts.length != 3) {
      return new AnalyzedToken(" ", null, null);
    }
    return new AnalyzedToken(parts[0], parts[1], parts[2]);
  }
View Full Code Here

      final List<AnalyzedTokenReadings> tokenReadings = new ArrayList<>();
      for (String word : sentenceTokens) {
        final List<AnalyzedToken> l = new ArrayList<>();
        // a real tagger would need to assign a POS tag
        // in the next line instead of null:
        l.add(new AnalyzedToken(word, null, null));
        tokenReadings.add(new AnalyzedTokenReadings(l, 0));
      }
      return tokenReadings;
    }
View Full Code Here

      return tokenReadings;
    }

    @Override
    public AnalyzedTokenReadings createNullToken(String token, int startPos) {
      return new AnalyzedTokenReadings(new AnalyzedToken(token, null, null),
              startPos);
    }
View Full Code Here

              startPos);
    }

    @Override
    public AnalyzedToken createToken(String token, String posTag) {
      return new AnalyzedToken(token, posTag, null);
    }
View Full Code Here

import org.languagetool.AnalyzedToken;

public class SpanishSynthesizerTest extends TestCase {
    private final AnalyzedToken dummyToken(String tokenStr) {
      return new AnalyzedToken(tokenStr, tokenStr, tokenStr);
    }
View Full Code Here

   *
   * @param lemmaString String that specifies the base form.
   */
  public final void setLemmaString(final String lemmaString) {
    if (!StringTools.isEmpty(lemmaString)) {
      formattedToken = new AnalyzedTokenReadings(new AnalyzedToken(lemmaString,
          posTag, lemmaString), 0);
      staticLemma = true;
      postagRegexp = true;
      if (posTag != null) {
        pPosRegexMatch = Pattern.compile(posTag);
View Full Code Here

    if (this.suppressMisspelled && lang != null) {
      final List<String> formattedStringElements = Arrays.asList(formattedString);
      //tagger-based speller
      final List<AnalyzedTokenReadings> analyzed = lang.getTagger().tag(formattedStringElements);
      for (int i = 0; i < formattedString.length; i++) {
        final AnalyzedToken analyzedToken = analyzed.get(i).getAnalyzedToken(0);
        if (analyzedToken.getLemma() == null && analyzedToken.hasNoTag()) {
          formattedString[i] = "";
        }
      }
    }
    return formattedString;
View Full Code Here

TOP

Related Classes of org.languagetool.AnalyzedToken

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.