* @throws MaltChainedException
*/
protected void initSplitParam(FeatureVector featureVector) throws MaltChainedException {
if (getGuide().getConfiguration().getOptionValue("guide", "data_split_column") == null
|| getGuide().getConfiguration().getOptionValue("guide", "data_split_column").toString().length() == 0) {
throw new GuideException("The option '--guide-data_split_column' cannot be found, when initializing the data split. ");
}
if (getGuide().getConfiguration().getOptionValue("guide", "data_split_structure") == null
|| getGuide().getConfiguration().getOptionValue("guide", "data_split_structure").toString().length() == 0) {
throw new GuideException("The option '--guide-data_split_structure' cannot be found, when initializing the data split. ");
}
try {
final String spec = "InputColumn(" + getGuide().getConfiguration().getOptionValue("guide", "data_split_column").toString().trim()+
", "+getGuide().getConfiguration().getOptionValue("guide", "data_split_structure").toString().trim() +")";
divideFeature = featureVector.getFeatureModel().identifyFeature(spec);
} catch (FeatureException e) {
throw new GuideException("The data split feature 'InputColumn("+getGuide().getConfiguration().getOptionValue("guide", "data_split_column").toString()+", "+getGuide().getConfiguration().getOptionValue("guide", "data_split_structure").toString()+") cannot be initialized. ", e);
}
if (!(divideFeature instanceof Modifiable)) {
throw new GuideException("The data split feature 'InputColumn("+getGuide().getConfiguration().getOptionValue("guide", "data_split_column").toString()+", "+getGuide().getConfiguration().getOptionValue("guide", "data_split_structure").toString()+") does not implement Modifiable interface. ");
}
divideFeatureIndexVector = new ArrayList<Integer>();
for (int i = 0; i < featureVector.size(); i++) {
if (featureVector.get(i).equals(divideFeature)) {
divideFeatureIndexVector.add(i);
}
}
// if ((Boolean)getGuide().getConfiguration().getOptionValue("malt0.4", "behavior") == true) {
// /* MaltParser 0.4 removes the divide feature for all divide models. For the "Sum-up" model or
// * master model adds the divide feature in the end of the feature vector.
// */
// masterFeatureVector = (FeatureVector)featureVector.clone();
// for (Integer i : divideFeatureIndexVector) {
// masterFeatureVector.remove(masterFeatureVector.get(i));
// }
// for (Integer i : divideFeatureIndexVector) {
// masterFeatureVector.add(featureVector.get(i));
// }
//
// divideFeatureVector = (FeatureVector)featureVector.clone();
// for (Integer i : divideFeatureIndexVector) {
// divideFeatureVector.remove(divideFeatureVector.get(i));
// }
// } else {
masterFeatureVector = featureVector;
divideFeatureVector = (FeatureVector)featureVector.clone();
for (Integer i : divideFeatureIndexVector) {
divideFeatureVector.remove(divideFeatureVector.get(i));
}
// }
try {
if (getGuide().getConfiguration().getOptionValue("guide", "data_split_threshold").toString() != null) {
divideThreshold = Integer.parseInt(getGuide().getConfiguration().getOptionValue("guide", "data_split_threshold").toString());
} else {
divideThreshold = 0;
}
} catch (NumberFormatException e) {
throw new GuideException("The --guide-data_split_threshold option is not an integer value. ", e);
}
}