private void constructBalancedSentiCorpus() throws IOException {
    balanceSentiment(
        prop.getProperty("senti.corpus.file.search"),
        prop.getProperty("senti.corpus.search.fields.delim"),
        OMTwitterCorpusFile.fieldNameToId(prop.getProperty("senti.corpus.search.fields"), "\\s+"),
        prop.getProperty("senti.corpus.file"),
        prop.getProperty("senti.corpus.fields.delim"),
        OMTwitterCorpusFile.fieldNameToId(prop.getProperty("senti.corpus.fields"), "\\s+"),
        false);

    balanceSentiment(
        prop.getProperty("senti.corpus.file.sample"),
        prop.getProperty("senti.corpus.sample.fields.delim"),
        OMTwitterCorpusFile.fieldNameToId(prop.getProperty("senti.corpus.sample.fields"), "\\s+"),
        prop.getProperty("senti.corpus.file"),
        prop.getProperty("senti.corpus.fields.delim"),
        OMTwitterCorpusFile.fieldNameToId(prop.getProperty("senti.corpus.fields"), "\\s+"),
        true);

    printCorpusStat(
        prop.getProperty("senti.corpus.file"),
        prop.getProperty("senti.corpus.fields.delim"),
        OMTwitterCorpusFile.fieldNameToId(prop.getProperty("senti.corpus.fields"), "\\s+"));
  }
  @Override
  public void initialize() throws ResourceInitializationException {
    super.initialize();

    logger = getLogger();

    try {
      evalCorpusReader =
          new OMTwitterCorpusFileReader(
              (String) getConfigParameterValue(PARAM_EVALUATION_CORPUS_FILE),
              (String) getConfigParameterValue(PARAM_EVALUATION_CORPUS_DELIM),
              OMTwitterCorpusFile.fieldNameToId(
                  (String) getConfigParameterValue(PARAM_EVALUATION_CORPUS_FIELDS), " "));
    } catch (Exception e) {
      logger.log(Level.SEVERE, e.getMessage());
      throw new ResourceInitializationException(e);
    }

    printResult = (Boolean) getConfigParameterValue(PARAM_PRINT_RESULT);

    String neTagsStr = (String) getConfigParameterValue(PARAM_NAMED_ENTITY_TAGS);
    if (neTagsStr == null) {
      throw new ResourceInitializationException();
    }

    labelNone = (String) getConfigParameterValue(PARAM_LABEL_NONE);

    String[] neTags = neTagsStr.split(" ");
    int idx = 0;
    map = new HashMap<String, Integer>();

    for (String tag : neTags) {
      map.put(tag + "_B", idx++);
      map.put(tag + "_M", idx++);
      map.put(tag + "_E", idx++);
    }
    map.put(labelNone, idx++);
    labelNoneIdx = idx - 1;

    stat = new int[idx][3];
    senti = new int[3][3];
    classifiedEntityCnt = new int[idx / 3];
    answerEntityCnt = new int[idx / 3];
  }