/**
   * 어간부가 음/기 로 끝나는 경우
   *
   * @param o the analyzed output
   * @param candidates candidates
   * @throws MorphException throw exception
   */
  public static boolean analysisMJ(AnalysisOutput o, List<AnalysisOutput> candidates)
      throws MorphException {

    int strlen = o.getStem().length();

    if (strlen < 2) return false;

    char[] chrs = MorphUtil.decompose(o.getStem().charAt(strlen - 1));
    boolean success = false;

    if (o.getStem().charAt(strlen - 1) != '기' && !(chrs.length == 3 && chrs[2] == 'ㅁ'))
      return false;

    String start = o.getStem();
    String end = "";
    if (o.getStem().charAt(strlen - 1) == '기') {
      start = o.getStem().substring(0, strlen - 1);
      end = "기";
    } else if (o.getStem().charAt(strlen - 1) == '음') {
      start = o.getStem().substring(0, strlen - 1);
      end = "음";
    }

    String[] eomis = EomiUtil.splitEomi(start, end);
    if (eomis[0] == null) return false;
    String[] pomis = EomiUtil.splitPomi(eomis[0]);
    o.setStem(pomis[0]);
    o.addElist(eomis[1]);
    o.setPomi(pomis[1]);

    try {
      if (analysisVMJ(o.clone(), candidates)) return true;
      if (analysisNSMJ(o.clone(), candidates)) return true;
      if (analysisVMXMJ(o.clone(), candidates)) return true;
    } catch (CloneNotSupportedException e) {
      throw new MorphException(e.getMessage(), e);
    }

    if (DictionaryUtil.getVerb(o.getStem()) != null) {
      o.setPos(PatternConstants.POS_VERB);
      o.setPatn(PatternConstants.PTN_VMJ);
      o.setScore(AnalysisOutput.SCORE_CORRECT);
      candidates.add(o);
      return true;
    }

    return false;
  }
  /**
   * 용언 + '아/어' + 보조용언 + '음/기' + 조사(PTN_VMXMJ)
   *
   * @param o the analyzed output
   * @param candidates candidates
   * @throws MorphException throw exception
   */
  public static boolean analysisVMXMJ(AnalysisOutput o, List<AnalysisOutput> candidates)
      throws MorphException {

    int idxXVerb = VerbUtil.endsWithXVerb(o.getStem());

    if (idxXVerb != -1) { // 2. 사랑받아보다
      String eogan = o.getStem().substring(0, idxXVerb);
      o.setXverb(o.getStem().substring(idxXVerb));

      String[] stomis = null;
      if (eogan.endsWith("아") || eogan.endsWith("어"))
        stomis =
            EomiUtil.splitEomi(
                eogan.substring(0, eogan.length() - 1), eogan.substring(eogan.length() - 1));
      else stomis = EomiUtil.splitEomi(eogan, "");
      if (stomis[0] == null) return false;

      String[] irrs = IrregularUtil.restoreIrregularVerb(stomis[0], stomis[1]);
      if (irrs != null) {
        o.setStem(irrs[0]);
        o.addElist(irrs[1]);
      } else {
        o.setStem(stomis[0]);
        o.addElist(stomis[1]);
      }

      if (DictionaryUtil.getVerb(o.getStem()) != null) {
        o.setPatn(PatternConstants.PTN_VMXMJ);
        o.setPos(PatternConstants.POS_VERB);
        o.setScore(AnalysisOutput.SCORE_CORRECT);
        candidates.add(o);
        return true;
      } else if (analysisNSMXMJ(o, candidates)) {
        return true;
      }
    }

    return false;
  }