Package org.apache.ctakes.ytex.kernel.tree

Examples of org.apache.ctakes.ytex.kernel.tree.Node


    }
    for (long instanceId2 : rightDocumentIDs) {
      // if (instanceId1 != instanceId2) {
      final long i1 = instanceId1;
      final long i2 = instanceId2;
      final Node root1 = instanceIDMap.get(i1);
      final Node root2 = instanceIDMap.get(i2);
      if (root1 != null && root2 != null) {
        kernelEvaluationDao.storeKernel(kernelEvaluation, i1, i2,
            instanceKernel.evaluate(root1, root2));
      }
    }
View Full Code Here


      double keval = 0;
      // iterate through the 'indices' and the weights
      for (Map.Entry<Integer, Double> indexWeight : mapIndexWeight
          .entrySet()) {
        // get the pair of matching nodes
        Node n1 = getNodeForIndex(indexWeight.getKey(), (Node) o1);
        Node n2 = getNodeForIndex(indexWeight.getKey(), (Node) o2);
        if (n1 != null && n2 != null) {
          // evaluate the kernel, multiply by weight, add to running
          // sum
          keval += (delegateKernel.evaluate(n1, n2) * indexWeight
              .getValue());
 
View Full Code Here

   * them.
   *
   * @return sum( sum( K(child(i),child(j) ) ) )
   */
  public double evaluate(Object c1, Object c2) {
    Node n1 = (Node) c1;
    Node n2 = (Node) c2;
    double d = 0;
    for (Node child1 : n1.getChildren()) {
      for (Node child2 : n2.getChildren()) {
        // if node type specified, they have to match
        if (getNodeType() == null
            || (getNodeType().equals(child1.getType()) && getNodeType()
                .equals(child2.getType()))) {
          d += delegateKernel.evaluate(child1, child2);
View Full Code Here

  private static final String CONF_ATTR = "confidence";
  private static final String CERT_ATTR = "certainty";

  @Override
  public double evaluate(Object c1, Object c2) {
    Node ne1 = (Node) c1;
    Node ne2 = (Node) c2;
    Number confidence1 = (Number) ne1.getValue().get(CONF_ATTR);
    Number confidence2 = (Number) ne2.getValue().get(CONF_ATTR);
    Integer certainty1 = (Integer) ne1.getValue().get(CERT_ATTR);
    Integer certainty2 = (Integer) ne2.getValue().get(CERT_ATTR);
    double negationFactor = 1;
    if (confidence1 != null && confidence2 != null
        && !confidence1.equals(confidence2))
      negationFactor = -1;
    double certaintyFactor = 1;
View Full Code Here

    this.delegateKernel = delegateKernel;
  }

  @Override
  public double evaluate(Object o1, Object o2) {
    Node n1 = (Node) o1;
    Node n2 = (Node) o2;
    if (n1 != null && n2 != null && n1.getType().equals(n2.getType())) {
      Object attr1 = n1.getValue().get(attributeName);
      Object attr2 = n2.getValue().get(attributeName);
      if (attr1 != null && attr1 != null) {
        return delegateKernel.evaluate(attr1, attr2);
      }
    }
    return 0;
View Full Code Here

TOP

Related Classes of org.apache.ctakes.ytex.kernel.tree.Node

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.