class DifferentLengthRule extends BitextRule {

  private static final int MAX_SKEW = 250;
  private static final int MIN_SKEW = 30;

  public DifferentLengthRule() {
    setLocQualityIssueType(ITSIssueType.Length);
  }

  @Override
  public String getDescription() { 
    return "Check if translation length is similar to source length";
  }
  
  @Override
  public String getId() {
    return "TRANSLATION_LENGTH";
  }

  @Override
  public String getMessage() {
    return "Source and target translation lengths are very different";
  }

  @Override
  public RuleMatch[] match(AnalyzedSentence sourceText,
      AnalyzedSentence targetText) throws IOException {<FILL_FUNCTION_BODY>}
  
  private boolean isLengthDifferent(String src, String trg) {
    double skew = ((double) src.length() / (double) trg.length()) * 100.00;
    return skew > MAX_SKEW || skew < MIN_SKEW;
  }
  
}

   
    if (isLengthDifferent(sourceText.getText(), targetText.getText())) {
      AnalyzedTokenReadings[] tokens = targetText.getTokens();
      int endPos = tokens[tokens.length - 1].getStartPos() + tokens[tokens.length - 1].getToken().length();
      return new RuleMatch[] { new RuleMatch(this, targetText, 0, endPos, getMessage()) };
    }
    return new RuleMatch[0];
  
<methods>public non-sealed void <init>() ,public final List<org.languagetool.bitext.StringPair> getCorrectBitextExamples() ,public final List<org.languagetool.rules.bitext.IncorrectBitextExample> getIncorrectBitextExamples() ,public abstract java.lang.String getMessage() ,public static List<Class<? extends org.languagetool.rules.bitext.BitextRule>> getRelevantRules() ,public final org.languagetool.Language getSourceLanguage() ,public abstract org.languagetool.rules.RuleMatch[] match(org.languagetool.AnalyzedSentence, org.languagetool.AnalyzedSentence) throws java.io.IOException,public org.languagetool.rules.RuleMatch[] match(org.languagetool.AnalyzedSentence) throws java.io.IOException,public final void setCorrectBitextExamples(List<org.languagetool.bitext.StringPair>) ,public final void setIncorrectBitextExamples(List<org.languagetool.rules.bitext.IncorrectBitextExample>) ,public final void setSourceLanguage(org.languagetool.Language) <variables>private List<org.languagetool.bitext.StringPair> correctExamples,private List<org.languagetool.rules.bitext.IncorrectBitextExample> incorrectExamples,private org.languagetool.Language sourceLanguage