Examples of FeatureValue


Examples of org.apache.uima.caseditor.editor.FeatureValue

      IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();

      Object element = selection.getFirstElement();

      if (element instanceof FeatureValue) {
        FeatureValue featureValue = (FeatureValue) element;

        if (!featureValue.getFeature().getRange().isPrimitive()) {
          featureValue.getFeatureStructure().setFeatureValue(featureValue.getFeature(), null);

          document.update(featureValue.getFeatureStructure());
        }
      } else if (element instanceof ArrayValue) {
          ArrayValue arrayValue = (ArrayValue) element;

          ArrayFS array = (ArrayFS) arrayValue.getFeatureStructure();
View Full Code Here

Examples of org.apache.uima.caseditor.editor.FeatureValue

      boolean result = false;

      if (selection.size() == 1) {
        if (selection.getFirstElement() instanceof FeatureValue) {
          FeatureValue featureValue = (FeatureValue) selection.getFirstElement();

          result = !featureValue.getFeature().getRange().isPrimitive() &&
              featureValue.getFeatureStructure().getFeatureValue(featureValue.getFeature()) != null;
        }
        else if (selection.getFirstElement() instanceof ArrayValue) {
          ArrayValue arrayValue = (ArrayValue) selection.getFirstElement();

            if (arrayValue.getFeatureStructure() instanceof ArrayFS) {
View Full Code Here

Examples of org.apache.uima.caseditor.editor.FeatureValue

    @Override
    public void run() {
      IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();

      if (selection.getFirstElement() instanceof FeatureValue) {
        FeatureValue featureValue = (FeatureValue) selection.getFirstElement();

        FeatureStructure newValue;

        Type fsSuperType = featureValue.getFeature().getRange();

        if (!fsSuperType.isArray()) {
          List<Type> subTypes =
              document.getCAS().getTypeSystem().getProperlySubsumedTypes(fsSuperType);

          Type typeToCreate;
          int arraySize = -1;

          if (subTypes.size() == 0) {
            typeToCreate = fsSuperType;
          }
          else {
             CreateFeatureStructureDialog createFsDialog =
                 new CreateFeatureStructureDialog(Display.getCurrent()
                         .getActiveShell(), fsSuperType, document.getCAS().getTypeSystem());

             int returnCode = createFsDialog.open();

             if (returnCode == IDialogConstants.OK_ID) {
               typeToCreate = createFsDialog.getType();
               arraySize = createFsDialog.getArraySize();
             }
             else {
               return;
             }
          }

          newValue = createFS(typeToCreate, arraySize);

          document.addFeatureStructure(newValue);
        } else {
          Type arrayType = featureValue.getFeature().getRange();

          CreateFeatureStructureDialog createArrayDialog = new CreateFeatureStructureDialog(Display.getCurrent()
                  .getActiveShell(), arrayType, document.getCAS().getTypeSystem());

          int returnCode = createArrayDialog.open();

          if (returnCode == IDialogConstants.OK_ID) {
            newValue = createFS(arrayType, createArrayDialog.getArraySize());
          } else {
            return;
          }
        }

        featureValue.getFeatureStructure().setFeatureValue(featureValue.getFeature(), newValue);
        document.update(featureValue.getFeatureStructure());
      }
      else if (selection.getFirstElement() instanceof ArrayValue) {
        ArrayValue value = (ArrayValue) selection.getFirstElement();

View Full Code Here

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

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

 
  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

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

  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

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

    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

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

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

    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

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

   
    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
TOP
Copyright © 2018 www.massapi.com. 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.