protected static Instance assignWekaAttributes(Instances instances, Word data_point) {
    double[] instance = new double[instances.numAttributes()];

    for (int i = 0; i < instances.numAttributes(); ++i) {
      Attribute attribute = instances.attribute(i);
      if (data_point.hasAttribute(attribute.name()) &&
          !data_point.getAttribute(attribute.name()).toString().equals("?")) {
        switch (attribute.type()) {
          case Attribute.NOMINAL:
            int index = attribute.indexOfValue(data_point.getAttribute(attribute.name()).toString());
            instance[i] = (double) index;
            break;
          case Attribute.NUMERIC:
            // Check if value is really a number.
            try {
              instance[i] = Double.valueOf(data_point.getAttribute(attribute.name()).toString());
            } catch (NumberFormatException e) {
              AuToBIUtils.error("Number expected for feature: " + attribute.name());
            }
            break;
          case Attribute.STRING:
            instance[i] = attribute.addStringValue(data_point.getAttribute(attribute.name()).toString());
            break;
          default:
            AuToBIUtils.error("Unknown attribute type");
        }
      } else {
        instance[i] = Instance.missingValue();
      }
    }

    Instance inst = new Instance(1, instance);
    inst.setDataset(instances);
    return inst;
  }