Package org.maltparserx.core.feature.value

Examples of org.maltparserx.core.feature.value.FeatureValue


      StringBuilder sb = new StringBuilder();
      try {
        sb.append(decision.getDecisionCode()+"\t");
        int n = featureVector.size();
        for (int i = 0; i < n; i++) {
          FeatureValue featureValue = featureVector.get(i).getFeatureValue();
          if (excludeNullValues == true && featureValue.isNullValue()) {
            sb.append("-1");
          } else {
            if (featureValue instanceof SingleFeatureValue) {
              sb.append(((SingleFeatureValue)featureValue).getIndexCode()+"");
            } else if (featureValue instanceof MultipleFeatureValue) {
View Full Code Here


 
  public void update() throws MaltChainedException {
    singleFeatureValue.reset();
    firstFeature.update();
    secondFeature.update();
    FeatureValue firstValue = firstFeature.getFeatureValue();
    FeatureValue secondValue = secondFeature.getFeatureValue();
    if (firstValue instanceof SingleFeatureValue && secondValue instanceof SingleFeatureValue) {
      String firstSymbol = ((SingleFeatureValue)firstValue).getSymbol();
      if (firstValue.isNullValue() && secondValue.isNullValue()) {
        singleFeatureValue.setIndexCode(firstFeature.getSymbolTable().getSymbolStringToCode(firstSymbol));
        singleFeatureValue.setSymbol(firstSymbol);
        singleFeatureValue.setNullValue(true);
      } else {
        if (column.getType() == ColumnDescription.STRING) {
          StringBuilder mergedValue = new StringBuilder();
          mergedValue.append(firstSymbol);
          mergedValue.append('~');
          mergedValue.append(((SingleFeatureValue)secondValue).getSymbol());
          singleFeatureValue.setIndexCode(table.addSymbol(mergedValue.toString()));
          singleFeatureValue.setSymbol(mergedValue.toString());
          singleFeatureValue.setNullValue(false);
          singleFeatureValue.setValue(1);
        } else {
          if (firstValue.isNullValue() || secondValue.isNullValue()) {
            singleFeatureValue.setValue(0);
            table.addSymbol("#null#");
            singleFeatureValue.setSymbol("#null#");
            singleFeatureValue.setNullValue(true);
            singleFeatureValue.setIndexCode(1);
View Full Code Here

  public void update() throws MaltChainedException {
    singleFeatureValue.reset();
    firstFeature.update();
    secondFeature.update();
    thirdFeature.update();
    FeatureValue firstValue = firstFeature.getFeatureValue();
    FeatureValue secondValue = secondFeature.getFeatureValue();
    FeatureValue thirdValue = thirdFeature.getFeatureValue();

    if (firstValue instanceof SingleFeatureValue && secondValue instanceof SingleFeatureValue && thirdValue instanceof SingleFeatureValue) {
      String firstSymbol = ((SingleFeatureValue)firstValue).getSymbol();
      if (firstValue.isNullValue() && secondValue.isNullValue() && thirdValue.isNullValue()) {
        singleFeatureValue.setIndexCode(firstFeature.getSymbolTable().getSymbolStringToCode(firstSymbol));
        singleFeatureValue.setSymbol(firstSymbol);
        singleFeatureValue.setNullValue(true);
      } else {
        if (column.getType() == ColumnDescription.STRING) {
          StringBuilder mergedValue = new StringBuilder();
          mergedValue.append(((SingleFeatureValue)firstValue).getSymbol());
          mergedValue.append('~');
          mergedValue.append(((SingleFeatureValue)secondValue).getSymbol());
          mergedValue.append('~');
          mergedValue.append(((SingleFeatureValue)thirdValue).getSymbol());
          singleFeatureValue.setIndexCode(table.addSymbol(mergedValue.toString()))
          singleFeatureValue.setSymbol(mergedValue.toString());
          singleFeatureValue.setNullValue(false);
          singleFeatureValue.setValue(1);
        } else {
          if (firstValue.isNullValue() || secondValue.isNullValue() || thirdValue.isNullValue()) {
            singleFeatureValue.setValue(0);
            table.addSymbol("#null#");
            singleFeatureValue.setSymbol("#null#");
            singleFeatureValue.setNullValue(true);
            singleFeatureValue.setIndexCode(1);
View Full Code Here

    return table.getSymbolCodeToString(code);
  }
 
  public void update() throws MaltChainedException {
    parentFeature.update();
    FeatureValue value = parentFeature.getFeatureValue();
    if (value instanceof SingleFeatureValue) {
      String symbol = ((SingleFeatureValue)value).getSymbol();
      if (((FeatureValue)value).isNullValue()) {
        multipleFeatureValue.addFeatureValue(parentFeature.getSymbolTable().getSymbolStringToCode(symbol), symbol);
        multipleFeatureValue.setNullValue(true);
View Full Code Here

    StringBuilder sb = new StringBuilder();
    try {
      sb.append(decision.getDecisionCode()+"\t");
      int n = featureVector.size();
      for (int i = 0; i < n; i++) {
        FeatureValue featureValue = featureVector.get(i).getFeatureValue();
        if (excludeNullValues == true && featureValue.isNullValue()) {
          sb.append("-1");
        } else {
          if (featureValue instanceof SingleFeatureValue) {
            sb.append(((SingleFeatureValue)featureValue).getIndexCode()+"");
          } else if (featureValue instanceof MultipleFeatureValue) {
View Full Code Here

    if (featureMap == null) {
      featureMap = loadFeatureMap(getInputStreamFromConfigFileEntry(".map"));
    }
    int i = 1;
    for (FeatureFunction feature : featureVector) {
      final FeatureValue featureValue = feature.getFeatureValue();
      if (!(excludeNullValues == true && featureValue.isNullValue())) {
        if (featureValue instanceof SingleFeatureValue) {
          int v = getFeatureMapValue(i, ((SingleFeatureValue)featureValue).getIndexCode());
          if (v != -1) {
            featureSet.add(new XNode(v,1));
          }
View Full Code Here

   
    try {
      sb.append(decision.getDecisionCode()+"\t");
      final int n = featureVector.size();
      for (int i = 0; i < n; i++) {
        FeatureValue featureValue = featureVector.getFeatureValue(i);
        if (featureValue == null || (excludeNullValues == true && featureValue.isNullValue())) {
          sb.append("-1");
        } else {
          if (!featureValue.isMultiple()) {
            SingleFeatureValue singleFeatureValue = (SingleFeatureValue)featureValue;
            if (singleFeatureValue.getValue() == 1) {
              sb.append(singleFeatureValue.getIndexCode());
            } else if (singleFeatureValue.getValue() == 0) {
              sb.append("-1");
View Full Code Here

//      throw new LibException("The learner cannot predict the next class, because the feature vector cannot be found. ");
//    }
    final FeatureList featureList = new FeatureList();
    final int size = featureVector.size();
    for (int i = 1; i <= size; i++) {
      final FeatureValue featureValue = featureVector.getFeatureValue(i-1)
      if (featureValue != null && !(excludeNullValues == true && featureValue.isNullValue())) {
        if (!featureValue.isMultiple()) {
          SingleFeatureValue singleFeatureValue = (SingleFeatureValue)featureValue;
          final int index = featureMap.getIndex(i, singleFeatureValue.getIndexCode());
          if (index != -1 && singleFeatureValue.getValue() != 0) {
            featureList.add(index,singleFeatureValue.getValue());
          }
View Full Code Here

      throw new LibsvmException("The decision cannot be found");
   
    try {
      instanceOutput.write(decision.getDecisionCode()+"\t");
      for (int i = 0; i < featureVector.size(); i++) {
        FeatureValue featureValue = featureVector.get(i).getFeatureValue();
        if (excludeNullValues == true && featureValue.isNullValue()) {
          instanceOutput.write("-1");
        } else {
          if (featureValue instanceof SingleFeatureValue) {
            instanceOutput.write(((SingleFeatureValue)featureValue).getIndexCode()+"");
          } else if (featureValue instanceof MultipleFeatureValue) {
View Full Code Here

TOP

Related Classes of org.maltparserx.core.feature.value.FeatureValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.