Package org.languagetool

Examples of org.languagetool.Language


      System.out.println("   <atdUrlPrefix>  URL prefix of After the Deadline server, like 'http://localhost:1059/checkDocument?data='");
      System.out.println("   <sentenceLimit> Maximum number of sentences to check, or 0 for no limit");
      System.out.println("   <file...>       Wikipedia and/or Tatoeba file(s)");
      System.exit(1);
    }
    Language language = Language.getLanguageForShortName(args[0]);
    String urlPrefix = args[1];
    int maxSentenceCount = Integer.parseInt(args[2]);
    List<String> files = Arrays.asList(args).subList(3, args.length);
    AfterTheDeadlineChecker atdChecker = new AfterTheDeadlineChecker(urlPrefix, maxSentenceCount);
    atdChecker.run(language, files);
View Full Code Here


      final int nextTokenPos, final List<Match> suggestionMatches)
          throws IOException {
    String[] finalMatch = null;
    if (suggestionMatches.get(start) != null) {
      final int len = phraseLen(index);
      final Language language = rule.language;
      if (len == 1) {
        final int skippedTokens = nextTokenPos - tokenIndex;
        final MatchState matchState = suggestionMatches.get(start).createState(language.getSynthesizer(), tokens, tokenIndex - 1, skippedTokens);
        finalMatch = matchState.toFinalString(language);
        if (suggestionMatches.get(start).checksSpelling()
            && finalMatch.length == 1
            && "".equals(finalMatch[0])) {
          finalMatch = new String[1];
          finalMatch[0] = MISTAKE;
        }
      } else {
        final List<String[]> matchList = new ArrayList<>();
        for (int i = 0; i < len; i++) {
          final int skippedTokens = nextTokenPos - (tokenIndex + i);
          final MatchState matchState = suggestionMatches.get(start).createState(language.getSynthesizer(), tokens, tokenIndex - 1 + i, skippedTokens);
          matchList.add(matchState.toFinalString(language));
        }
        return combineLists(matchList.toArray(new String[matchList.size()][]),
            new String[matchList.size()], 0, language);
      }
View Full Code Here

*/
public final class POSTagLanguageModel {

  public static void main(final String[] args) throws IOException {
    if (args.length == 1) {
      final Language language = getLanguageOrExit(args[0]);
      final JLanguageTool lt = new JLanguageTool(language, null);
      runOnStdIn(lt);
    } else {
      exitWithUsageMessage();
    }
View Full Code Here

      exitWithUsageMessage();
    }
  }

  private static Language getLanguageOrExit(final String lang) {
    Language language = null;
    boolean foundLanguage = false;
    final List<String> supportedLanguages = new ArrayList<>();
    for (final Language tmpLang : Language.LANGUAGES) {
      supportedLanguages.add(tmpLang.getShortName());
      if (lang.equals(tmpLang.getShortName())) {
View Full Code Here

    if (args.length != 2) {
      System.err.println("Usage: " + BlogChecker.class.getSimpleName() + " <langCode> <contentDir>");
      System.exit(1);
    }
    BlogChecker checker = new BlogChecker();
    Language lang = Language.getLanguageForShortName(args[0]);
    checker.check(new File(args[1]), lang);
  }
View Full Code Here

    for (Language element : Language.REAL_LANGUAGES) {
      sortedLanguages.add(element.getName());
    }
    Collections.sort(sortedLanguages);
    for (String langName : sortedLanguages) {
      Language lang = Language.getLanguageForName(langName);
      int commits = getActivityFor(lang, PAST_DAYS);
      System.out.println(commits + "\t" + lang.getName() + (lang.isVariant() ? " (including the parent language)" : ""));
    }
  }
View Full Code Here

      setToken(attrs);
    } else if (qName.equals(TRANSLATION)) {
      inTranslation = true;
      final String languageStr = attrs.getValue("lang");
      if (Language.isLanguageSupported(languageStr)) {
        final Language tmpLang = Language.getLanguageForShortName(languageStr);
        currentTranslationLanguage = tmpLang;
        if (tmpLang.equalsConsiderVariantsIfSpecified(motherTongue)) {
          translationLanguage = tmpLang;
        }
      }
    } else if (qName.equals(EXAMPLE)
        && attrs.getValue(TYPE).equals("correct")) {
View Full Code Here

    final String compoundSentence = "To jest kobieta-wojownik w polsko-czeskim ubraniu, która wysłała dwa SMS-y.";
    List<String> compoundTokens = wordTokenizer.tokenize(compoundSentence);
    assertEquals(21, compoundTokens.size());
    assertEquals("[To,  , jest,  , kobieta-wojownik,  , w,  , polsko-czeskim,  , ubraniu, ,,  , która,  , wysłała,  , dwa,  , SMS-y, .]", compoundTokens.toString());
    //now setup the tagger...
    Language pl = new Polish();
    wordTokenizer.setTagger(pl.getTagger());
    compoundTokens = wordTokenizer.tokenize(compoundSentence);
    //we should get 4 more tokens: two hyphen tokens and two for the split words
    assertEquals(25, compoundTokens.size());
    assertEquals("[To,  , jest,  , kobieta, -, wojownik,  , " +
        "w,  , polsko, -, czeskim,  , ubraniu, ,,  " +
View Full Code Here

public class MorfologikSouthAfricanSpellerRuleTest extends AbstractEnglishSpellerRuleTest {

  @Test
  public void testSuggestions() throws IOException {
    Language language = new SouthAfricanEnglish();
    Rule rule = new MorfologikSouthAfricanSpellerRule(TestTools.getMessages("en"), language);
    super.testNonVariantSpecificSuggestions(rule, language);
  }
View Full Code Here

public class MorfologikAustralianSpellerRuleTest extends AbstractEnglishSpellerRuleTest {

  @Test
  public void testSuggestions() throws IOException {
    Language language = new AustralianEnglish();
    Rule rule = new MorfologikAustralianSpellerRule(TestTools.getMessages("en"), language);
    super.testNonVariantSpecificSuggestions(rule, language);
  }
View Full Code Here

TOP

Related Classes of org.languagetool.Language

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.