Package org.languagetool.language

Examples of org.languagetool.language.Polish


    assertTrue(output.contains("Rule ID: WORD_REPEAT_RULE"));
    assertEquals(1, matches);
  }

  public void testCorrect() throws IOException, ParserConfigurationException, SAXException {
    JLanguageTool tool = new JLanguageTool(new Polish());
    tool.activateDefaultPatternRules();
    tool.activateDefaultFalseFriendRules();

    String correct = Tools.correctText("To jest całkowicie prawidłowe zdanie.", tool);
    assertEquals("To jest całkowicie prawidłowe zdanie.", correct);
View Full Code Here


import org.languagetool.rules.WordRepeatRule;

public class WordRepeatRuleTest extends TestCase {

  public void testRulePolish() throws IOException {
    final Polish polish = new Polish();
    final WordRepeatRule rule = new WordRepeatRule(TestTools.getEnglishMessages(), polish);
    RuleMatch[] matches;
    final JLanguageTool langTool = new JLanguageTool(polish);
    // correct sentences:
    matches = rule.match(langTool.getAnalyzedSentence("To jest zdanie."));
View Full Code Here

public class PolishUnpairedBracketsRuleTest extends TestCase {

  public void testRulePolish() throws IOException {
    PolishUnpairedBracketsRule rule = new PolishUnpairedBracketsRule(TestTools
        .getEnglishMessages(), new Polish());
    RuleMatch[] matches;
    JLanguageTool langTool = new JLanguageTool(new Polish());
    // correct sentences:
    matches = rule.match(langTool
        .getAnalyzedSentence("(To jest zdanie do testowania)."));
    assertEquals(0, matches.length);
    // correct sentences:
View Full Code Here

public class CompoundRuleTest extends CompoundRuleTestAbs {

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    langTool = new JLanguageTool(new Polish());
    rule = new CompoundRule(null);
  }
View Full Code Here

    // other tests for special characters
    final String germanSpecialChars = check(german, "ein kleiner test. Und wieder Erwarten noch was: öäüß+ öäüß.");
    assertTrue("Expected special chars, got: '" + germanSpecialChars + "'", germanSpecialChars.contains("öäüß+"));
    final String romanianSpecialChars = check(new Romanian(), "bla bla șțîâă șțîâă și câteva caractere speciale");
    assertTrue("Expected special chars, got: '" + romanianSpecialChars + "'", romanianSpecialChars.contains("șțîâă"));
    final Polish polish = new Polish();
    final String polishSpecialChars = check(polish, "Mówiła długo, żeby tylko mówić mówić długo.");
    assertTrue("Expected special chars, got: '" + polishSpecialChars+ "'", polishSpecialChars.contains("mówić"));
    // test http POST
    assertTrue(checkByPOST(new Romanian(), "greșit greșit").contains("greșit"));
    // test supported language listing
View Full Code Here

import java.util.List;

public class FalseFriendsAsBitextLoaderTest extends TestCase {

  public void testHintsForPolishTranslators() throws IOException, ParserConfigurationException, SAXException {
    final Polish polish = new Polish();
    final English english = new English();
    final JLanguageTool langTool = new JLanguageTool(english, polish);
    final JLanguageTool trgTool = new JLanguageTool(polish);
   
    final FalseFriendsAsBitextLoader ruleLoader = new FalseFriendsAsBitextLoader();
View Full Code Here

  }
 
  public void testBitextCheck() throws IOException, ParserConfigurationException, SAXException {
    final English english = new English();
    final JLanguageTool srcTool = new JLanguageTool(english);
    final Polish polish = new Polish();
    final JLanguageTool trgTool = new JLanguageTool(polish);
    trgTool.activateDefaultPatternRules();
   
    final List<BitextRule> rules = Tools.getBitextRules(english, polish);
   
View Full Code Here

  }

  public void testSpeller() throws Exception {
    //tests with synthesizer
    Match match = getMatch("POS1", "POS2", true);
    final Polish polish = new Polish();
    MatchState matchState = new MatchState(match, polish.getSynthesizer());
    matchState.setToken(getAnalyzedTokenReadings("inflectedform11", "POS1", "Lemma1"));
    //getting empty strings, which is what we want
    assertEquals("[]", Arrays.toString(matchState.toFinalString(polish)));

    // contrast with a speller = false!
    match = getMatch("POS1", "POS2", false);
    matchState = new MatchState(match, polish.getSynthesizer());
    matchState.setToken(getAnalyzedTokenReadings("inflectedform11", "POS1", "Lemma1"));
    assertEquals("[(inflectedform11)]", Arrays.toString(matchState.toFinalString(polish)));

    //and now a real word - we should get something
    match = getMatch("subst:sg:acc.nom:m3", "subst:sg:gen:m3", true);
    matchState = new MatchState(match, polish.getSynthesizer());
    matchState.setToken(getAnalyzedTokenReadings("AON", "subst:sg:acc.nom:m3", "AON"));
    assertEquals("[AON-u]", Arrays.toString(matchState.toFinalString(polish)));

    //and now pure text changes       
    match = getTextMatch("^(.*)$", "$0-u", true);
    match.setSynthesizer(polish.getSynthesizer());
    match.setLemmaString("AON");
    matchState = new MatchState(match, polish.getSynthesizer());
    assertEquals("[AON-u]", Arrays.toString(matchState.toFinalString(polish)));
    match.setLemmaString("batalion");
    //should be empty
    matchState = new MatchState(match, polish.getSynthesizer());
    assertEquals("[]", Arrays.toString(matchState.toFinalString(polish)));
    match.setLemmaString("ASEAN");
    //and this one not
    matchState = new MatchState(match, polish.getSynthesizer());
    assertEquals("[ASEAN-u]", Arrays.toString(matchState.toFinalString(polish)));
  }
View Full Code Here

public class MorfologikPolishSpellerRuleTest {

  @Test
  public void testMorfologikSpeller() throws IOException {
    final MorfologikPolishSpellerRule rule =
        new MorfologikPolishSpellerRule (TestTools.getMessages("pl"), new Polish());

    final JLanguageTool langTool = new JLanguageTool(new Polish());

    // correct sentences:
    assertEquals(0, rule.match(langTool.getAnalyzedSentence("To jest test bez jakiegokolwiek błędu.")).length);
    assertEquals(0, rule.match(langTool.getAnalyzedSentence("Żółw na starość wydziela dziwną woń.")).length);
    //test for "LanguageTool":
View Full Code Here

import java.io.IOException;

public class UppercaseSentenceStartRuleTest extends TestCase {

  public void testPolishSpecialCases() throws IOException {
    final JLanguageTool lt = new JLanguageTool(new Polish());
    assertEquals(0, lt.check("Zdanie.").size());
    assertEquals(0, lt.check("To jest lista punktowana:\n\npunkt pierwszy,\n\npunkt drugi,\n\npunkt trzeci.").size());
  }
View Full Code Here

TOP

Related Classes of org.languagetool.language.Polish

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.