Package org.maltparserx.core.feature.value

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


    Class<?>[] paramTypes = { java.lang.String.class, org.maltparserx.core.feature.function.AddressFunction.class };
    return paramTypes;
  }

  public void update()  throws MaltChainedException {
    final AddressValue a = addressFunction.getAddressValue();
   
    if (a.getAddress() == null) {
      if (getSymbolTable() != null) {
        featureValue.setIndexCode(getSymbolTable().getNullValueCode(NullValueId.NO_NODE));
        featureValue.setSymbol(getSymbolTable().getNullValueSymbol(NullValueId.NO_NODE));
      } else {
        featureValue.setIndexCode(0);
        featureValue.setSymbol("#null");
      }
//      featureValue.setKnown(true);
      featureValue.setNullValue(true);     
    } else {
      final DependencyNode node = (DependencyNode)a.getAddress();
      if (!node.isRoot()) {
        if (getSymbolTable() != null && node.hasLabel(getSymbolTable())) {
          featureValue.setIndexCode(node.getLabelCode(getSymbolTable()));
          featureValue.setSymbol(getSymbolTable().getSymbolCodeToString(node.getLabelCode(getSymbolTable())));
//          featureValue.setKnown(getSymbolTable().getKnown(node.getLabelCode(getSymbolTable())));
View Full Code Here


    Class<?>[] paramTypes = { java.lang.String.class, org.maltparserx.core.feature.function.AddressFunction.class };
    return paramTypes;
  }

  public void update()  throws MaltChainedException {
    final AddressValue a = addressFunction.getAddressValue();
   
    if (a.getAddress() == null) {
      featureValue.setIndexCode(getSymbolTable().getNullValueCode(NullValueId.NO_NODE));
      featureValue.setSymbol(getSymbolTable().getNullValueSymbol(NullValueId.NO_NODE));
//      featureValue.setKnown(true);
      featureValue.setNullValue(true);     
    } else {
//      try {
//        a.getAddressClass().asSubclass(org.maltparser.core.syntaxgraph.node.DependencyNode.class);

        final DependencyNode node = (DependencyNode)a.getAddress();
        if (!node.isRoot()) {
          if (node.hasHead()) {
            featureValue.setIndexCode(node.getHeadEdge().getLabelCode(getSymbolTable()));
            featureValue.setSymbol(getSymbolTable().getSymbolCodeToString(node.getHeadEdge().getLabelCode(getSymbolTable())));
//            featureValue.setKnown(getSymbolTable().getKnown(node.getHeadEdge().getLabelCode(getSymbolTable())));
View Full Code Here

//    featureValue.setCardinality(table.getValueCounter());
  }

  public void update() throws MaltChainedException {
    // Retrieve the address value
    final AddressValue arg1 = addressFunction1.getAddressValue();
    final AddressValue arg2 = addressFunction2.getAddressValue();
    if (arg1.getAddress() != null && arg1.getAddressClass() == org.maltparserx.core.syntaxgraph.node.DependencyNode.class &&
        arg2.getAddress() != null && arg2.getAddressClass() == org.maltparserx.core.syntaxgraph.node.DependencyNode.class) {
        DependencyNode node1 = (DependencyNode)arg1.getAddress();
        DependencyNode node2 = (DependencyNode)arg2.getAddress();
        try {
      int head1 = Integer.parseInt(node1.getLabelSymbol(column.getSymbolTable()));
      int head2 = Integer.parseInt(node2.getLabelSymbol(column.getSymbolTable()));
      if (!node1.isRoot() && head1 == node2.getIndex()) {
          featureValue.setIndexCode(table.getSymbolStringToCode("LEFT"));
View Full Code Here

    Class<?>[] paramTypes = { java.lang.String.class, org.maltparserx.core.feature.function.AddressFunction.class };
    return paramTypes;
  }
 
  public void update() throws MaltChainedException {
    final AddressValue a = addressFunction.getAddressValue();
   
    if (a.getAddress() == null) {
      featureValue.update(column.getSymbolTable().getNullValueCode(NullValueId.NO_NODE),
          column.getSymbolTable().getNullValueSymbol(NullValueId.NO_NODE), true, 1);
    } else {
        final DependencyNode node = (DependencyNode)a.getAddress();
       
        if (!node.isRoot()) {
          int indexCode = node.getLabelCode(column.getSymbolTable());
          String symbol = column.getSymbolTable().getSymbolCodeToString(indexCode);
          if (column.getType() == ColumnDescription.STRING) {
View Full Code Here

    Class<?>[] paramTypes = { org.maltparserx.core.feature.function.AddressFunction.class };
    return paramTypes;
  }
 
  public void update() throws MaltChainedException {
    final AddressValue a = addressFunction.getAddressValue();
    if (a.getAddress() == null) {
      address.setAddress(null);
    } else {
//      try {
//        a.getAddressClass().asSubclass(org.maltparser.core.syntaxgraph.node.DependencyNode.class);
   
        final DependencyNode node = (DependencyNode)a.getAddress();
        if (subFunction == DGraphSubFunction.HEAD && !node.isRoot()) {
          address.setAddress(node.getHead());
        } else if (subFunction == DGraphSubFunction.LDEP) {
          address.setAddress(node.getLeftmostDependent());
        } else if (subFunction == DGraphSubFunction.RDEP) {
View Full Code Here

   *
   * @throws MaltChainedException
   */
  public void update() throws MaltChainedException {
    // Retrieve the address value
    final AddressValue arg1 = addressFunction.getAddressValue();
    // if arg1 or arg2 is null, then set a NO_NODE null value as feature value
    if (arg1.getAddress() == null ) {
      featureValue.setIndexCode(table.getNullValueCode(NullValueId.NO_NODE));
      featureValue.setSymbol(table.getNullValueSymbol(NullValueId.NO_NODE));
      featureValue.setNullValue(true);     
    } else {
      // Unfortunately this method takes a lot of time  arg1.getAddressClass().asSubclass(org.maltparser.core.syntaxgraph.node.DependencyNode.class);
      // Cast the address arguments to dependency nodes
      final DependencyNode node = (DependencyNode)arg1.getAddress();
      int numof = 0;
      if (numOfRelation == NumOfRelation.DEPS) {
        numof = node.getLeftDependentCount() +  node.getRightDependentCount();
      } else if (numOfRelation == NumOfRelation.LDEPS) {
        numof = node.getLeftDependentCount();
View Full Code Here

//    featureValue.setCardinality(table.getValueCounter());
  }

  public void update() throws MaltChainedException {
    // Retrieve the address value
    final AddressValue arg1 = addressFunction1.getAddressValue();
    final AddressValue arg2 = addressFunction2.getAddressValue();
    try {

      if (arg1.getAddress() == null || arg2.getAddress() == null) {
        featureValue.setIndexCode(table.getNullValueCode(NullValueId.NO_NODE));
        featureValue.setSymbol(table.getNullValueSymbol(NullValueId.NO_NODE));
        featureValue.setNullValue(true);
      } else {
        final DependencyNode node1 = (DependencyNode)arg1.getAddress();
        final DependencyNode node2 = (DependencyNode)arg2.getAddress();
       
        int head1 = -1;
        int head2 = -1;

        if ( node1.hasHead() )
View Full Code Here

* @author Johan Hall
*/
public abstract class AddressFunction implements Function {
  protected AddressValue address;
  public AddressFunction() {
    address = new AddressValue(this);
  }
View Full Code Here

   *
   * @throws MaltChainedException
   */
  public void update() throws MaltChainedException {
    // Retrieve the address value
    final AddressValue arg1 = addressFunction1.getAddressValue();
    final AddressValue arg2 = addressFunction2.getAddressValue();
//    featureValue.setKnown(true);
    // if arg1 or arg2 is null, then set a NO_NODE null value as feature value
    if (arg1.getAddress() == null || arg2.getAddress() == null) {
      featureValue.setIndexCode(table.getNullValueCode(NullValueId.NO_NODE));
      featureValue.setSymbol(table.getNullValueSymbol(NullValueId.NO_NODE));
      featureValue.setValue(1);

      featureValue.setNullValue(true);     
    } else {
      // Unfortunately this method takes a lot of time  arg1.getAddressClass().asSubclass(org.maltparser.core.syntaxgraph.node.DependencyNode.class);
      // Cast the address arguments to dependency nodes
      final DependencyNode node1 = (DependencyNode)arg1.getAddress();
      final DependencyNode node2 = (DependencyNode)arg2.getAddress();
     
      if (!node1.isRoot() && !node2.isRoot()) {
        // Calculates the distance
        final int index1 = node1.getIndex();
        final int index2 = node2.getIndex();
View Full Code Here

    Class<?>[] paramTypes = { java.lang.String.class, org.maltparserx.core.feature.function.AddressFunction.class };
    return paramTypes;
  }

  public void update()  throws MaltChainedException {
    final AddressValue a = addressFunction.getAddressValue();
   
    if (a.getAddress() == null) {
      featureValue.update(column.getSymbolTable().getNullValueCode(NullValueId.NO_NODE),
          column.getSymbolTable().getNullValueSymbol(NullValueId.NO_NODE), true, 1);
    } else {
      final DependencyNode node = (DependencyNode)a.getAddress();
      if (!node.isRoot()) {
        if (node.hasHead()) {
          int indexCode = node.getHeadEdge().getLabelCode(column.getSymbolTable());
          String symbol = column.getSymbolTable().getSymbolCodeToString(indexCode);
          if (column.getType() == ColumnDescription.STRING) {
View Full Code Here

TOP

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

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.