Esempio n. 1
0
  /**
   * returns all SofaTextMention objects with type "problem" in this SofaText object
   *
   * @return
   */
  public Collection<? extends SofaTextMention> getProblems() {
    List<SofaTextMention> problems = new ArrayList<SofaTextMention>();

    for (SofaTextMention stm : sofaTextMention) {
      if (stm.getMentionType().equals("problem")) problems.add(stm);
    }

    return problems;
  }
Esempio n. 2
0
  /**
   * returns all SofaTextMention objects with type "treatment" in this SofaText object
   *
   * @return
   */
  public Collection<? extends SofaTextMention> getTreatments() {
    List<SofaTextMention> treatments = new ArrayList<SofaTextMention>();

    for (SofaTextMention stm : sofaTextMention) {
      if (stm.getMentionType().equals("treatment")) treatments.add(stm);
    }

    return treatments;
  }
Esempio n. 3
0
  /**
   * Helper method to generate HTML, will be moved to controller in future, the html contains the
   * text of the SofaText object with each mention wrapped in a span tag
   *
   * @return
   */
  public String getAnnotatedHTML() {
    String html = new String(text);
    String tagged;
    for (SofaTextMention m : sofaTextMention) {
      tagged = wrapInMentionTypeTag(m.getMentionText(), m.getMentionType());
      // System.out.println(tagged);

      if (!m.getSofaTextMentionConcept().isEmpty()) tagged = wrapInConceptTag(tagged, m);

      html = html.replace(m.getMentionText(), tagged);
      // html = html.replaceAll("\\n", "<br/>");
    }
    return html;
  }