public void convertStringAttsToNominal(){
  Instances miningSchemaI=getFieldsAsInstances();
  if (miningSchemaI.checkForStringAttributes()) {
    ArrayList<Attribute> attInfo=new ArrayList<Attribute>();
    for (int i=0; i < miningSchemaI.numAttributes(); i++) {
      Attribute tempA=miningSchemaI.attribute(i);
      if (tempA.isString()) {
        ArrayList<String> valueVector=new ArrayList<String>();
        for (int j=0; j < tempA.numValues(); j++) {
          valueVector.add(tempA.value(j));
        }
        Attribute newAtt=new Attribute(tempA.name(),valueVector);
        attInfo.add(newAtt);
      }
 else {
        attInfo.add(tempA);
      }
    }
    Instances newI=new Instances("miningSchema",attInfo,0);
    if (m_fieldInstancesStructure.classIndex() >= 0) {
      newI.setClassIndex(m_fieldInstancesStructure.classIndex());
    }
    m_fieldInstancesStructure=newI;
  }
}

public void convertStringAttsToNominal ( ) { Instances miningSchemaI = getFieldsAsInstances ( ) ; if ( miningSchemaI . checkForStringAttributes ( ) ) { ArrayList < Attribute > attInfo = new ArrayList < Attribute > ( ) ; for ( int i = 0 ; i < miningSchemaI . numAttributes ( ) ; i ++ ) { Attribute tempA = miningSchemaI . attribute ( i ) ; if ( tempA . isString ( ) ) { ArrayList < String > valueVector = new ArrayList < String > ( ) ; for ( int j = 0 ; j < tempA . numValues ( ) ; j ++ ) { valueVector . add ( tempA . value ( j ) ) ; } Attribute newAtt = new Attribute ( tempA . name ( ) , valueVector ) ; attInfo . add ( newAtt ) ; } else { attInfo . add ( tempA ) ; } } Instances newI = new Instances ( "miningSchema" , attInfo , 0 ) ; if ( m_fieldInstancesStructure . classIndex ( ) >= 0 ) { newI . setClassIndex ( m_fieldInstancesStructure . classIndex ( ) ) ; } m_fieldInstancesStructure = newI ; } }
method to convert any string attributes in the mining schema instances to nominal attributes . this may be necessary if there are no value elements defined for categorical fields in the data dictionary . in this case , elements in the actual model definition will probably reveal the valid values for categorical fields .
