/**
   * Loads a compiled grammar from a file.
   *
   * @param grammar A file representing the compiled G2G-formatted grammar.
   * @return <code>true</code> on success
   */
  public boolean loadGrammar(File grammar) {
    boolean successful = false;

    // Check directory contents...
    String[] contents = grammar.getParentFile().list();
    for (String content : contents) {
      Log.e(TAG, content);
    }

    mGrammar = grammar;

    String path = mGrammar.getPath();

    try {
      mSrec = new Recognizer(SREC_DIR + "/baseline11k.par");
      mSrecGrammar = mSrec.new Grammar(path);
      mSrecGrammar.setupRecognizer();
      mSrecGrammar.resetAllSlots();

      successful = true;
    } catch (IllegalStateException e) {
      Log.e(TAG, e.toString());

      String[] contents2 = grammar.getParentFile().list();
      for (String content : contents2) {
        Log.e(TAG, "+" + content);
      }

      e.printStackTrace();
    } catch (IOException e) {
      Log.e(TAG, e.toString());

      e.printStackTrace();
    }

    if (!successful) {
      if (mSrecGrammar != null) {
        mSrecGrammar.destroy();
      }

      if (mSrec != null) {
        mSrec.destroy();
      }

      mSrecGrammar = null;
      mGrammar = null;
      mSrec = null;
    }

    return successful;
  }