Examples of ConcRel


Examples of org.apache.ctakes.ytex.kernel.model.ConcRel

  protected UMLSDao umlsDao;

  private void addConcepts(ConceptGraph cg, String conceptId,
      Set<String> nodesToInclude, Set<String> leaves) {
    ConcRel cr = cg.getConceptMap().get(conceptId);
    // only process this node if it isn't already in the list
    if (!nodesToInclude.contains(cr.getConceptID())) {
      // add me to the list
      nodesToInclude.add(cr.getConceptID());
      // iterate over parents and recurse
      for (ConcRel crp : cr.getParents()) {
        addConcepts(cg, crp.getConceptID(), nodesToInclude, leaves);
        // parent is not a leaf - remove it from the list of candidate
        // leaves
        leaves.remove(crp.getConceptID());
      }
View Full Code Here

Examples of org.apache.ctakes.ytex.kernel.model.ConcRel

  public void exportSubtree(String conceptID, Properties props)
      throws IOException {
    Set<String> nodes = new HashSet<String>();
    ConceptGraph cg = this.conceptDao.getConceptGraph(props
        .getProperty("org.apache.ctakes.ytex.conceptGraphName"));
    ConcRel cr = cg.getConceptMap().get(conceptID);
    if (cr != null) {
      addSubtree(nodes, cr);
    }
    BufferedWriter w = null;
    try {
View Full Code Here

Examples of org.apache.ctakes.ytex.kernel.model.ConcRel

      double ic = 1e6;
      Map<String, ConcRel> conceptMap = this
          .getConceptSimilarityService().getConceptGraph()
          .getConceptMap();
      for (String c : bestConcepts) {
        ConcRel cr = conceptMap.get(c);
        if (cr != null && cr.getIntrinsicInfoContent() < ic) {
          ic = cr.getIntrinsicInfoContent();
          bestConcept = c;
        }
      }
    }
    // get the best scoring concept
View Full Code Here

Examples of org.apache.ctakes.ytex.kernel.model.ConcRel

      Map<String, FeatureRank> mapChildConcept, FeatureEvaluation fe,
      ConceptGraph cg, Map<String, Double> conceptICMap,
      Map<String, Double> conceptRawEvalMap,
      Map<FeatureRank, Set<FeatureRank>> childParentMap,
      double imputeWeight, double minInfo) {
    ConcRel cr = cg.getConceptMap().get(parentConcept.getFeatureName());
    Set<String> childConcepts = new HashSet<String>();
    addSubtree(childConcepts, cr);
    for (String childConceptId : childConcepts) {
      // only add the child to the map if it exists in the corpus
      if (conceptICMap.containsKey(childConceptId)) {
View Full Code Here

Examples of org.apache.ctakes.ytex.kernel.model.ConcRel

      // iterate over nodes that have a pagerank, and propagate the
      // pagerank to out-links.
      // pagerank
      double score = currentScores[index];
      // get concept id
      ConcRel cr = cg.getConceptList().get(index);
      // get number of out-links
      double nOutlinks = (double) cr.getChildren().size();
      if (nOutlinks > 0) {
        // propagate pagerank to out-links (children)
        for (ConcRel crOut : cr.getChildren()) {
          int targetIndex = crOut.getNodeIndex();
          // get current pagerank value for target page
          double childScore = newScores[targetIndex];
          // add the pagerank/|links|
          childScore += (score / nOutlinks);
View Full Code Here

Examples of org.apache.ctakes.ytex.kernel.model.ConcRel

      double dampingFactor, double N) {
    double newScores[] = new double[(int) N];
    double jump = ((1 - dampingFactor) / N);
    for (int i = 0; i < currentScores.length; i++) {
      double score = 0d;
      ConcRel c = cg.getConceptList().get(i);
      // get nodes pointing at node c
      for (int parentIndex : c.getParentsArray()) {
        ConcRel p = cg.getConceptList().get(parentIndex);
        // get the pagerank for node p which is pointing at c
        // if this is the first iteration, currentScores is null so
        // use the initial pagerank
        double prIn = currentScores[parentIndex];
        // add the pagerank divided by the number of nodes p is
        // pointing at
        score += (prIn / (double) p.getChildrenArray().length);
      }
      if (dampingVector == null) {
        // uniform damping
        newScores[i] = (score * dampingFactor) + jump;
      } else {
View Full Code Here

Examples of org.apache.ctakes.ytex.kernel.model.ConcRel

        // page (concept id)
        Integer index = scoreEntry.getKey();
        // pagerank
        double score = scoreEntry.getValue();
        // get concept id
        ConcRel cr = cg.getConceptList().get(index);
        // get number of out-links
        double nOutlinks = (double) cr.getChildren().size();
        if (nOutlinks > 0) {
          // propagate pagerank to out-links (children)
          for (ConcRel crOut : cr.getChildren()) {
            // get current pagerank value for target page
            double childScore = 0d;
            Double childScoreD = newScores
                .get(crOut.getNodeIndex());
            if (childScoreD != null)
View Full Code Here

Examples of org.apache.ctakes.ytex.kernel.model.ConcRel

   */
  @Override
  public double sim(String concept1, String concept2, ConceptGraph cg,
      int iter, double threshold, double dampingFactor) {
    Map<Integer, Double> c1dv = new HashMap<Integer, Double>(1);
    ConcRel c1 = cg.getConceptMap().get(concept1);
    ConcRel c2 = cg.getConceptMap().get(concept2);
    if (c1 == null || c2 == null)
      return 0d;
    c1dv.put(c1.getNodeIndex(), 1d);
    double[] c1pr = this.rank2(c1dv, cg, iter, threshold, dampingFactor);
    Map<Integer, Double> c2dv = new HashMap<Integer, Double>(1);
    c2dv.put(c2.getNodeIndex(), 1d);
    double[] c2pr = this.rank2(c2dv, cg, iter, threshold, dampingFactor);
    return cosine(c1pr, c2pr);
  }
View Full Code Here

Examples of org.apache.ctakes.ytex.kernel.model.ConcRel

    List<FeatureRank> listFeatureRank = new ArrayList<FeatureRank>(
        icInfoMap.size());
    double maxIC = 0d;
    short maxDepth = 0;
    for (IntrinsicICInfo icInfo : icInfoMap.values()) {
      ConcRel cr = icInfo.getConcept();
      short depth = depthArray[cr.getNodeIndex()];
      cr.setDepth(depth);
      if (depth > maxDepth)
        maxDepth = depth;
      double ic = computeIC(icInfo, maxLeaves);
      cr.setIntrinsicInfoContent(ic);
      if (ic > maxIC)
        maxIC = ic;
      if (log.isDebugEnabled())
        log.debug(icInfo.getConcept().getConceptID() + "=" + ic);
      listFeatureRank.add(new FeatureRank(fe, icInfo.getConcept()
View Full Code Here

Examples of org.apache.ctakes.ytex.kernel.model.ConcRel

    // Map<String, FeatureRank> frMap = getICOnDemand(new HashSet<String>(
    // Arrays.asList(concept)), true);
    // if (frMap.containsKey(concept))
    // return frMap.get(concept).getRank();
    // }
    ConcRel cr = this.cg.getConceptMap().get(concept);
    if (cr != null)
      return cr.getDepth();
    return 0;
  }
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.