public void generate(
      String configFile,
      String[] featureFiles,
      String trainDir,
      String inputExt,
      String mode,
      int bIdx,
      int eIdx)
      throws Exception {
    Element eConfig = UTXml.getDocumentElement(new FileInputStream(configFile));
    JointFtrXml[] xmls = getFeatureTemplates(featureFiles);
    String[] trainFiles = UTFile.getSortedFileListBySize(trainDir, inputExt, true), devFiles;
    JointReader reader = getJointReader(UTXml.getFirstElementByTagName(eConfig, TAG_READER));
    String language = getLanguage(eConfig);
    int i;

    b_generate = true;

    for (i = bIdx; i < eIdx; i++) {
      devFiles = new String[] {trainFiles[i]};

      if (mode.equals(NLPLib.MODE_POS))
        developComponentBoot(
            eConfig,
            reader,
            xmls,
            trainFiles,
            devFiles,
            getPOSTaggerForCollect(reader, xmls, trainFiles, i, language),
            mode,
            i);
      else if (mode.equals(NLPLib.MODE_DEP))
        developComponentBoot(eConfig, reader, xmls, trainFiles, devFiles, null, mode, i);
    }
  }
Exemple #2
0
  public PBRoleset(Element eRoleset) {
    init();

    setID(UTXml.getTrimmedAttribute(eRoleset, PBFLib.A_ID));
    setName(UTXml.getTrimmedAttribute(eRoleset, PBFLib.A_NAME));
    addVerbNetClasses(UTXml.getTrimmedAttribute(eRoleset, PBFLib.A_VNCLS));
    addRoles(eRoleset.getElementsByTagName(PBFLib.E_ROLE));
  }
Exemple #3
0
  public static String getTemplate(
      String element, String contents, String indent, String... attributes) {
    StringBuilder build = new StringBuilder();

    build.append(indent);
    build.append(UTXml.startsElement(false, element, attributes));
    build.append("\n");

    build.append(contents);
    build.append("\n");

    build.append(indent);
    build.append(UTXml.endsElement(element));

    return build.toString();
  }