You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by pk...@apache.org on 2012/12/19 14:38:15 UTC
svn commit: r1423859 -
/uima/sandbox/TextMarker/trunk/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/HtmlVisitor.java
Author: pkluegl
Date: Wed Dec 19 13:38:14 2012
New Revision: 1423859
URL: http://svn.apache.org/viewvc?rev=1423859&view=rev
Log:
no jira, removed commented code
Modified:
uima/sandbox/TextMarker/trunk/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/HtmlVisitor.java
Modified: uima/sandbox/TextMarker/trunk/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/HtmlVisitor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/TextMarker/trunk/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/HtmlVisitor.java?rev=1423859&r1=1423858&r2=1423859&view=diff
==============================================================================
--- uima/sandbox/TextMarker/trunk/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/HtmlVisitor.java (original)
+++ uima/sandbox/TextMarker/trunk/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/HtmlVisitor.java Wed Dec 19 13:38:14 2012
@@ -181,221 +181,5 @@ public class HtmlVisitor extends NodeVis
return annotationStack;
}
- //
- //
- // public void tag2annotation(Tag tag, String name, CAS cas) {
- // Type type = getType(name, cas);
- // if (name.endsWith("/")) {
- // name = name.substring(0, name.length() - 1);
- // }
- // if (name.equals("STYLE")) {
- // tag.setEndPosition(tag.getEndTag().getStartPosition());
- // }
- // int begin = getOffset(tag.getStartPosition());
- //
- // delta += tag.getEndPosition() - tag.getStartPosition();
- // int i;
- // int end = tag.getEndPosition();
- // if (tag.getEndTag() != null) {
- // i = tag.getEndTag().getStartPosition();
- // end = tag.getEndTag().getEndPosition();
- // } else {
- // // TODO fix this
- // i = tag.getEndPosition();
- // tag.toString();
- // String startTag = "<" + tag.getRawTagName();
- // String endTag = "</" + tag.getRawTagName() + ">";
- // int j = i - 1;
- // int k = i - 2;
- // while (k < j && k > -1) {
- // k = cas.getDocumentText().indexOf(startTag, k + 1);
- // j = cas.getDocumentText().indexOf(endTag, j + 1);
- // }
- // if (i < j) {
- // i = j;
- // }
- //
- // }
- //
- // if (onlyContent) {
- // begin = getOffset(tag.getEndPosition());
- // end = i;
- // }
- // AnnotationFS annotation = cas.createAnnotation(type, begin, end);
- // for (int k = 0; k < tag.getAttributesEx().size(); k++) {
- // String test = tag.getAttributesEx().elementAt(k).toString();
- // if (test.startsWith(" ") | test.startsWith("/")) {
- // tag.getAttributesEx().remove(k);
- // k--;
- // }
- // }
- // if (name.equals("STYLE") || name.equals("TITLE") || name.equals("SCRIPT")) {
- // annotation.setFeatureValueFromString(annotation.getType().getFeatureByBaseName("name"),
- // tag.getText());
- // } else {
- // annotation.setFeatureValueFromString(annotation.getType().getFeatureByBaseName("name"), name);
- // }
- //
- // StringArray attributeName;
- // StringArray attributeValue;
- // int size = tag.getAttributesEx().size() - 1;
- // attributeName = new StringArray(jcas, size);
- // attributeValue = new StringArray(jcas, size);
- // for (int j = 0; j < size; j++) {
- // Attribute attribute = (Attribute) tag.getAttributesEx().elementAt(j + 1);
- // attributeName.set(j, attribute.getName());
- // attributeValue.set(j, attribute.getValue());
- // }
- // if (i <= tag.getEndPosition()) {
- // HtmlAnnotation annotationDelta = new HtmlAnnotation(annotation, delta, attributeName,
- // attributeValue, name, stripHtml);
- // annotationList.add(annotationDelta);
- // } else {
- // HtmlAnnotation annotationDelta = new HtmlAnnotation(annotation, delta, attributeName,
- // attributeValue, name, stripHtml);
- // annotations.add(annotationDelta);
- // }
- // }
- //
- // private int getOffset(int offset) {
- // if (stripHtml) {
- // return offset - delta;
- // }
- // return offset;
- // }
- //
- // public void setDelta(Tag tag, String name, CAS cas) {
- // delta = tag.getStartPosition();
- // plainTextDocument = plainTextDocument.substring(delta);
- // tag2annotation(tag, name, cas);
- // }
- //
- // public void head2annotation(Tag tag, String name, CAS cas) {
- // Type type = getType(name, cas);
- // if (name.equals("STYLE")) {
- // tag.setEndPosition(tag.getEndTag().getStartPosition());
- // }
- // int begin = getOffset(tag.getStartPosition());
- //
- // delta += tag.getEndPosition() - tag.getStartPosition();
- // int i;
- // int end = tag.getEndPosition();
- // if (tag.getEndTag() != null) {
- // i = tag.getEndTag().getStartPosition();
- // end = tag.getEndTag().getEndPosition();
- // } else {
- // // TODO fix this
- // i = tag.getEndPosition();
- // String startTag = "<" + tag.getRawTagName();
- // String endTag = "</" + tag.getRawTagName() + ">";
- // int j = i - 1;
- // int k = i - 2;
- // while (k < j && k > -1) {
- // k = cas.getDocumentText().indexOf(startTag, k + 1);
- // j = cas.getDocumentText().indexOf(endTag, j + 1);
- // }
- // if (i < j) {
- // i = j;
- // }
- //
- // }
- //
- // if (onlyContent) {
- // begin = getOffset(tag.getEndPosition());
- // end = i;
- // }
- //
- // AnnotationFS annotation = cas.createAnnotation(type, begin, end);
- // for (int k = 0; k < tag.getAttributesEx().size(); k++) {
- // String test = tag.getAttributesEx().elementAt(k).toString();
- // if (test.startsWith(" ") | test.startsWith("/")) {
- // tag.getAttributesEx().remove(k);
- // k--;
- // }
- // }
- // if (tag.getEndTag() != null && !name.equals("HEAD")) {
- // name = plainTextDocument.substring(tag.getEndPosition(), tag.getEndTag().getStartPosition());
- // }
- // StringArray attributeName;
- // StringArray attributeValue;
- // int size = tag.getAttributesEx().size() - 1;
- // attributeName = new StringArray(jcas, size);
- // attributeValue = new StringArray(jcas, size);
- // for (int j = 0; j < size; j++) {
- // Attribute attribute = (Attribute) tag.getAttributesEx().elementAt(j + 1);
- // attributeName.set(j, attribute.getName());
- // attributeValue.set(j, attribute.getValue());
- // }
- // HtmlAnnotation annotationDelta = new HtmlAnnotation(annotation, 0, attributeName,
- // attributeValue, name, stripHtml);
- // annotationList.add(annotationDelta);
- //
- // }
- //
- // public void node2annotation(Remark tag) {
- // Type type = getType("REMARK", cas);
- // int begin = getOffset(tag.getStartPosition());
- //
- // delta += tag.getEndPosition() - tag.getStartPosition();
- // int end = tag.getEndPosition();
- //
- // if (onlyContent) {
- // begin = getOffset(tag.getEndPosition());
- // }
- // AnnotationFS annotation = cas.createAnnotation(type, begin, end);
- // HtmlRemark remark = new HtmlRemark(annotation, 0, stripHtml);
- // String comment = tag.getText();
- // remark.setComment(comment);
- // remarks.add(remark);
- // }
- //
- // public void headNode2annotation(Remark tag) {
- // Type type = getType("REMARK", cas);
- // int begin = getOffset(tag.getStartPosition());
- //
- // delta += tag.getEndPosition() - tag.getStartPosition();
- // int end = tag.getEndPosition();
- // if (onlyContent) {
- // begin = getOffset(tag.getEndPosition());
- // }
- //
- // AnnotationFS annotation = cas.createAnnotation(type, begin, end);
- //
- // HtmlRemark remark = new HtmlRemark(annotation, 0, stripHtml);
- // String comment = tag.getText();
- // remark.setComment(comment);
- // remarks.add(remark);
- // }
- //
- // public void endTag(Tag endtag) {
- // int size = annotations.size();
- // if (size > 0) {
- // HtmlAnnotation annotationDelta = annotations.get(size - 1);
- // String test = endtag.getRawTagName().toUpperCase().substring(1);
- //
- // if (annotationDelta
- // .getAnnotation()
- // .getFeatureValueAsString(
- // annotationDelta.getAnnotation().getType().getFeatureByBaseName("name"))
- // .equals(test)) {
- // annotationDelta.changeDelta(delta);
- // annotationList.add(annotationDelta);
- // annotations.remove(size - 1);
- // }
- // }
- // delta += endtag.getEndPosition() - endtag.getStartPosition();
- // }
- //
- // public String getPlainTextDocument() {
- // return plainTextDocument;
- // }
- //
- // public List<HtmlAnnotation> getAnnotationList() {
- // return annotationList;
- // }
- //
- // public List<HtmlRemark> getRemarks() {
- // return remarks;
- // }
}