public void initialize() throws ResourceInitializationException {

    // extract configuration parameter settings
    String otrain = (String) getUimaContext().getConfigParameterValue("outTrainFile");
    String otest = (String) getUimaContext().getConfigParameterValue("outTestFile");
    mGoldFile = (String) getUimaContext().getConfigParameterValue("goldFile");
    mTrainNum = (Integer) getUimaContext().getConfigParameterValue("trainNum");
    
    // Output file should be specified in the descriptor
    if (otrain == null) {
      throw new ResourceInitializationException(
              ResourceInitializationException.CONFIG_SETTING_ABSENT, new Object[] { "outputFile" });
    }
    // TODO: try branching
    // If specified output directory does not exist, try to create it
    outFile = new File(otrain.trim());
    if (outFile.getParentFile() != null && !outFile.getParentFile().exists()) {
      if (!outFile.getParentFile().mkdirs())
        throw new ResourceInitializationException(
                ResourceInitializationException.RESOURCE_DATA_NOT_VALID, new Object[] { otrain,
                    "outputFile" });
    }
    try {
      trainWriter = new FileWriter(outFile);
      testWriter = new FileWriter(new File(otest));
    } catch (IOException e) {
      throw new ResourceInitializationException(e);
    }
    
    // Read golden standard
    if(mgoldMap == null)
      mgoldMap = readGoldGM();
  }