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/08/09 15:17:58 UTC
svn commit: r1371195 - in /uima/sandbox/trunk/TextMarker:
uimaj-ep-textmarker-engine/
uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/
uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/wizards/
uimaj-text...
Author: pkluegl
Date: Thu Aug 9 13:17:57 2012
New Revision: 1371195
URL: http://svn.apache.org/viewvc?rev=1371195&view=rev
Log:
UIMA-2329
- added analysis engine for html documents in utils folder
- instantiated types for most well-known tags
- add annotations for content or complete element
- able to strip html, but still adds annotations of removed tags
- organized imports
Added:
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/AnnotationDelta.java
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/HtmlAnnotator.java
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/HtmlVisitor.java
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/Remarks.java
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/resources/org/apache/uima/textmarker/engine/HtmlAnnotator.xml
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/resources/org/apache/uima/textmarker/engine/HtmlTypeSystem.xml
Modified:
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/pom.xml
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/TextMarkerKeywords.java
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/wizards/TextMarkerProjectCreationWizard.java
uima/sandbox/trunk/TextMarker/uimaj-textmarker/pom.xml
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/condition/PositionCondition.java
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/resource/TreeWordList.java
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/seed/SeedLexer.java
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/DebugCreatedBy.java
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/DebugCreatedBy_Type.java
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/TokenSeed.java
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/TokenSeed_Type.java
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/verbalize/ScriptVerbalizer.java
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/action/MarkFastTest.java
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/condition/CurrentCountTest.java
Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/pom.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/pom.xml?rev=1371195&r1=1371194&r2=1371195&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/pom.xml (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/pom.xml Thu Aug 9 13:17:57 2012
@@ -139,7 +139,7 @@
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
- <excludeArtifactIds>uimaj-core,uimaj-tools,uimaj-document-annotation,uimaj-adapter-vinci,jVinci,uimaj-cpe</excludeArtifactIds>
+ <excludeArtifactIds>uimaj-core,uimaj-tools,uimaj-document-annotation,uimaj-adapter-vinci,jVinci,uimaj-cpe,tools</excludeArtifactIds>
</configuration>
</execution>
</executions>
Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/TextMarkerKeywords.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/TextMarkerKeywords.java?rev=1371195&r1=1371194&r2=1371195&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/TextMarkerKeywords.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/TextMarkerKeywords.java Thu Aug 9 13:17:57 2012
@@ -31,7 +31,7 @@ public class TextMarkerKeywords implemen
"BLOCK", "RULES", "BOOLEANLIST", "INTLIST", "DOUBLELIST", "FLOATLIST","STRINGLIST",
"TYPELIST" };
- private static String[] action = { "DEL", "CALL", "MARK", "MARKSCORE", "COLOR", "LOG", "TAG",
+ private static String[] action = { "DEL", "CALL", "MARK", "MARKSCORE", "COLOR", "LOG",
"REPLACE", "FILLOBJECT", "RETAINTYPE", "SETFEATURE", "ASSIGN", "PUTINLIST",
"ATTRIBUTE", "MARKFAST", "FILTERTYPE", "CREATE", "FILL", "MARKTABLE",
"UNMARK", "TRANSFER", "MARKONCE", "TRIE", "GATHER", "EXEC", "MARKLAST", "ADD", "REMOVE",
Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/wizards/TextMarkerProjectCreationWizard.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/wizards/TextMarkerProjectCreationWizard.java?rev=1371195&r1=1371194&r2=1371195&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/wizards/TextMarkerProjectCreationWizard.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/wizards/TextMarkerProjectCreationWizard.java Thu Aug 9 13:17:57 2012
@@ -20,6 +20,7 @@
package org.apache.uima.textmarker.ide.ui.wizards;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -137,83 +138,36 @@ public class TextMarkerProjectCreationWi
}
private void copyDescriptors(IFolder descFolder) {
+ File descDir = descFolder.getLocation().toFile();
+ File utilsDir = new File(descFolder.getLocation().toFile(), "utils/");
+ copy(descDir, "BasicTypeSystem.xml");
+ copy(descDir, "BasicEngine.xml");
+ copy(descDir, "InternalTypeSystem.xml");
+
+ copy(utilsDir, "Modifier.xml");
+ copy(utilsDir, "AnnotationWriter.xml");
+ copy(utilsDir, "StyleMapCreator.xml");
+ copy(utilsDir, "XMIWriter.xml");
+ copy(utilsDir, "SourceDocumentInformation.xml");
+ copy(utilsDir, "PlainTextAnnotator.xml");
+ copy(utilsDir, "PlainTextTypeSystem.xml");
+ copy(utilsDir, "HtmlAnnotator.xml");
+ copy(utilsDir, "HtmlTypeSystem.xml");
+ }
+
+ private void copy(File dir, String fileName) {
InputStream in = null;
OutputStream out = null;
+ in = TextMarkerEngine.class.getResourceAsStream(fileName);
try {
- in = TextMarkerEngine.class.getResourceAsStream("BasicTypeSystem.xml");
- out = new FileOutputStream(new File(descFolder.getLocation().toFile(), "BasicTypeSystem.xml"));
- if (in != null && out != null) {
- copy(in, out);
- }
-
- in = TextMarkerEngine.class.getResourceAsStream("BasicEngine.xml");
- out = new FileOutputStream(new File(descFolder.getLocation().toFile(), "BasicEngine.xml"));
- if (in != null && out != null) {
- copy(in, out);
- }
-
- in = TextMarkerEngine.class.getResourceAsStream("InternalTypeSystem.xml");
- out = new FileOutputStream(new File(descFolder.getLocation().toFile(),
- "InternalTypeSystem.xml"));
- if (in != null && out != null) {
- copy(in, out);
- }
-
- File utilsDir = new File(descFolder.getLocation().toFile(), "utils/");
- in = TextMarkerEngine.class.getResourceAsStream("Modifier.xml");
- out = new FileOutputStream(new File(utilsDir, "Modifier.xml"));
- if (in != null && out != null) {
- copy(in, out);
- }
- in = TextMarkerEngine.class.getResourceAsStream("AnnotationWriter.xml");
- out = new FileOutputStream(new File(utilsDir, "AnnotationWriter.xml"));
- if (in != null && out != null) {
- copy(in, out);
- }
- in = TextMarkerEngine.class.getResourceAsStream("StyleMapCreator.xml");
- out = new FileOutputStream(new File(utilsDir, "StyleMapCreator.xml"));
- if (in != null && out != null) {
- copy(in, out);
- }
- in = TextMarkerEngine.class.getResourceAsStream("XMIWriter.xml");
- out = new FileOutputStream(new File(utilsDir, "XMIWriter.xml"));
- if (in != null && out != null) {
- copy(in, out);
- }
- in = TextMarkerEngine.class.getResourceAsStream("SourceDocumentInformation.xml");
- out = new FileOutputStream(new File(utilsDir, "SourceDocumentInformation.xml"));
- if (in != null && out != null) {
- copy(in, out);
- }
- in = TextMarkerEngine.class.getResourceAsStream("PlainTextAnnotator.xml");
- out = new FileOutputStream(new File(utilsDir, "PlainTextAnnotator.xml"));
- if (in != null && out != null) {
- copy(in, out);
- }
- in = TextMarkerEngine.class.getResourceAsStream("PlainTextTypeSystem.xml");
- out = new FileOutputStream(new File(utilsDir, "PlainTextTypeSystem.xml"));
- if (in != null && out != null) {
- copy(in, out);
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- if (out != null) {
- try {
- out.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
+ out = new FileOutputStream(new File(dir, fileName));
+ } catch (FileNotFoundException e) {
+ System.err.println(e);
+ }
+ if (in != null && out != null) {
+ copy(in, out);
}
+
}
static void copy(InputStream fis, OutputStream fos) {
@@ -224,18 +178,20 @@ public class TextMarkerProjectCreationWi
} catch (IOException e) {
System.err.println(e);
} finally {
- if (fis != null)
+ if (fis != null) {
try {
fis.close();
} catch (IOException e) {
- e.printStackTrace();
+ System.err.println(e);
}
- if (fos != null)
+ }
+ if (fos != null) {
try {
fos.close();
} catch (IOException e) {
- e.printStackTrace();
+ System.err.println(e);
}
+ }
}
}
Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/pom.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/pom.xml?rev=1371195&r1=1371194&r2=1371195&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/pom.xml (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/pom.xml Thu Aug 9 13:17:57 2012
@@ -47,6 +47,11 @@
<scope>compile</scope>
</dependency>
<dependency>
+ <groupId>org.htmlparser</groupId>
+ <artifactId>htmlparser</artifactId>
+ <version>1.6</version>
+ </dependency>
+ <dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
@@ -90,11 +95,11 @@
</plugin>
</plugins>
</pluginManagement>
- <resources>
- <resource>
- <directory>src\main\resources</directory>
- </resource>
- </resources>
+ <resources>
+ <resource>
+ <directory>src\main\resources</directory>
+ </resource>
+ </resources>
<plugins>
<!-- generate java code for antlr grammars -->
<plugin>
@@ -130,7 +135,7 @@
</execution>
</executions>
</plugin>
-
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java?rev=1371195&r1=1371194&r2=1371195&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java Thu Aug 9 13:17:57 2012
@@ -21,6 +21,7 @@ package org.apache.uima.textmarker;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -180,7 +181,9 @@ public class TextMarkerStream extends FS
TextMarkerBasic beginAnchor = getBeginAnchor(annotation.getBegin());
TextMarkerBasic endAnchor = getEndAnchor(annotation.getEnd());
beginAnchor.addBegin(annotation, parent);
- endAnchor.addEnd(annotation, parent);
+ if(endAnchor!= null) {
+ endAnchor.addEnd(annotation, parent);
+ }
Collection<TextMarkerBasic> basicAnnotationsInWindow = getAllBasicsInWindow(annotation);
for (TextMarkerBasic basic : basicAnnotationsInWindow) {
basic.addPartOf(type);
@@ -416,7 +419,9 @@ public class TextMarkerStream extends FS
}
public Collection<TextMarkerBasic> getAllBasicsInWindow(AnnotationFS windowAnnotation) {
-
+ if(windowAnnotation.getBegin() >= windowAnnotation.getEnd()) {
+ return Collections.emptySet();
+ }
TextMarkerBasic beginAnchor = getBeginAnchor(windowAnnotation.getBegin());
if (beginAnchor.getEnd() == windowAnnotation.getEnd()) {
Collection<TextMarkerBasic> result = new ArrayList<TextMarkerBasic>(1);
Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/condition/PositionCondition.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/condition/PositionCondition.java?rev=1371195&r1=1371194&r2=1371195&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/condition/PositionCondition.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/condition/PositionCondition.java Thu Aug 9 13:17:57 2012
@@ -26,7 +26,6 @@ import org.apache.uima.cas.FSIterator;
import org.apache.uima.cas.Type;
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.textmarker.TextMarkerStream;
-import org.apache.uima.textmarker.action.MatchedTextAction;
import org.apache.uima.textmarker.expression.bool.BooleanExpression;
import org.apache.uima.textmarker.expression.number.NumberExpression;
import org.apache.uima.textmarker.expression.type.TypeExpression;
Added: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/AnnotationDelta.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/AnnotationDelta.java?rev=1371195&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/AnnotationDelta.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/AnnotationDelta.java Thu Aug 9 13:17:57 2012
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.engine.html;
+
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.jcas.cas.StringArray;
+
+public class AnnotationDelta {
+ private AnnotationFS annotation;
+
+ private int delta;
+
+ private StringArray attributeName;
+
+ private StringArray attributeValue;
+
+ private String name;
+
+ private boolean stripHtml;
+
+ public AnnotationDelta(AnnotationFS annotation, int delta, StringArray attributeName,
+ StringArray attributeValue, String name, boolean stripHtml) {
+ this.annotation = annotation;
+ this.delta = delta;
+ this.attributeName = attributeName;
+ this.attributeValue = attributeValue;
+ this.name = name;
+ this.stripHtml = stripHtml;
+ }
+
+ public void changeDelta(int omega) {
+ delta = omega;
+ }
+
+ public AnnotationFS getAnnotation() {
+ return annotation;
+ }
+
+ public int getDelta() {
+ if(stripHtml) {
+ return delta;
+ } else {
+ return 0;
+ }
+ }
+
+ public StringArray getAttributeName() {
+ return attributeName;
+ }
+
+ public StringArray getAttributeValue() {
+ return attributeValue;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
Added: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/HtmlAnnotator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/HtmlAnnotator.java?rev=1371195&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/HtmlAnnotator.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/HtmlAnnotator.java Thu Aug 9 13:17:57 2012
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.engine.html;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.uima.UimaContext;
+import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.CASException;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.cas.StringArray;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.htmlparser.Parser;
+import org.htmlparser.util.NodeList;
+import org.htmlparser.util.ParserException;
+
+public class HtmlAnnotator extends JCasAnnotator_ImplBase {
+ public static final String NAMESPACE = "org.apache.uima.textmarker.type.html.";
+
+ public static final String PLAIN_TEXT_OUTPUT = "plainTextOutput";
+
+ public static final String OUTPUT_VIEW_NAME = "outputViewName";
+
+ public static final String ONLY_CONTENT = "onlyContent";
+
+ private Boolean plainTextOutput;
+
+ private String outputViewName;
+
+ private Boolean onlyContent;
+
+ @Override
+ public void initialize(UimaContext aContext) throws ResourceInitializationException {
+ super.initialize(aContext);
+ plainTextOutput = (Boolean) aContext.getConfigParameterValue(PLAIN_TEXT_OUTPUT);
+ outputViewName = (String) aContext.getConfigParameterValue(OUTPUT_VIEW_NAME);
+ onlyContent = (Boolean) aContext.getConfigParameterValue(ONLY_CONTENT);
+ plainTextOutput = plainTextOutput == null ? false : plainTextOutput;
+ onlyContent = onlyContent == null ? true : onlyContent;
+ }
+
+ @Override
+ public void process(JCas jcas) throws AnalysisEngineProcessException {
+ CAS cas = jcas.getCas();
+ JCas outJCas = jcas;
+ CAS outCas = cas;
+
+ String documentText = cas.getDocumentText();
+ String plainTextDocument = documentText;
+ List<AnnotationDelta> annotationList = new ArrayList<AnnotationDelta>();
+ List<Remarks> remarks = new ArrayList<Remarks>();
+
+ try {
+ Parser parser = new Parser(documentText);
+ NodeList list = parser.parse(null);
+ HtmlVisitor visitor = new HtmlVisitor(jcas, plainTextOutput, onlyContent);
+ list.visitAllNodesWith(visitor);
+ plainTextDocument = visitor.getPlainTextDocument();
+ remarks = visitor.getRemarks();
+ annotationList = visitor.getAnnotationList();
+ } catch (ParserException e) {
+ throw new AnalysisEngineProcessException(e);
+ }
+
+ if (plainTextOutput) {
+ outCas = cas.createView(outputViewName);
+ try {
+ outJCas = outCas.getJCas();
+ } catch (CASException e) {
+ throw new AnalysisEngineProcessException(e);
+ }
+ outCas.setDocumentText(plainTextDocument);
+ }
+
+ for (int k = 0; k < remarks.size(); k++) {
+ Remarks remark = remarks.get(k);
+ AnnotationFS annotation;
+ Type type = outCas.getTypeSystem().getType(NAMESPACE + "REMARK");
+ annotation = outCas.createAnnotation(type, remark.getPosition(), remark.getPosition());
+ annotation.setFeatureValueFromString(annotation.getType().getFeatureByBaseName("comment"),
+ remark.getComment());
+ outCas.addFsToIndexes(annotation);
+ }
+ for (int i = 0; i < annotationList.size(); i++) {
+ AnnotationFS annotation;
+ AnnotationDelta annoDelta = annotationList.get(i);
+ int begin = annoDelta.getAnnotation().getBegin();
+ int end = annoDelta.getAnnotation().getEnd() - annoDelta.getDelta();
+
+ StringArray attributeName = new StringArray(outJCas, annoDelta.getAttributeName().size());
+ for (int j = 0; j < attributeName.size(); j++) {
+ attributeName.set(j, annoDelta.getAttributeName().get(j));
+ }
+ StringArray attributeValue = new StringArray(outJCas, annoDelta.getAttributeValue().size());
+ for (int k = 0; k < attributeName.size(); k++) {
+ attributeValue.set(k, annoDelta.getAttributeValue().get(k));
+ }
+ if(begin == 0 && end == 0) {
+ begin = 0;
+ end = outCas.getDocumentAnnotation().getEnd();
+ }
+ annotation = outCas.createAnnotation(annoDelta.getAnnotation().getType(), begin, end);
+
+ annotation.setFeatureValue(annotation.getType().getFeatureByBaseName("attributeName"),
+ attributeName);
+ annotation.setFeatureValue(annotation.getType().getFeatureByBaseName("attributeValue"),
+ attributeValue);
+
+ annotation.setFeatureValueFromString(annotation.getType().getFeatureByBaseName("name"),
+ annoDelta.getName());
+ outCas.addFsToIndexes(annotation);
+ }
+ }
+
+}
Added: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/HtmlVisitor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/HtmlVisitor.java?rev=1371195&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/HtmlVisitor.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/HtmlVisitor.java Thu Aug 9 13:17:57 2012
@@ -0,0 +1,268 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.engine.html;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.CASException;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.cas.StringArray;
+import org.htmlparser.Attribute;
+import org.htmlparser.Remark;
+import org.htmlparser.Tag;
+import org.htmlparser.visitors.NodeVisitor;
+
+public class HtmlVisitor extends NodeVisitor {
+
+ private int delta;
+
+ private CAS cas;
+
+ private boolean body = false;
+
+ private List<AnnotationDelta> annotationList = new ArrayList<AnnotationDelta>();
+
+ private List<AnnotationDelta> annotations = new ArrayList<AnnotationDelta>();
+
+ private List<Remarks> remarks = new ArrayList<Remarks>();
+
+ private String plainTextDocument;
+
+ private JCas jcas;
+
+ private boolean stripHtml;
+
+ private boolean onlyContent;
+
+ public HtmlVisitor(JCas jcas, boolean stripHtml, boolean onlyContent) {
+ super();
+ this.jcas = jcas;
+ this.cas = jcas.getCas();
+ this.stripHtml = stripHtml;
+ this.onlyContent = onlyContent;
+ plainTextDocument = cas.getDocumentText();
+ }
+
+ public void visitTag(Tag tag) {
+ String name = tag.getRawTagName().toUpperCase();
+ if (body == true) {
+ tag2annotation(tag, name, cas);
+ } else if (name.equals("BODY")) {
+ body = true;
+ setDelta(tag, name, cas);
+ } else if (name.equals("HTML")) {
+ tag.setStartPosition(0);
+ tag2annotation(tag, name, cas);
+ } else {
+ head2annotation(tag, name, cas);
+ }
+ }
+
+ public void visitRemarkNode(Remark node) {
+ if (body == true) {
+ node2annotation(node);
+ } else {
+ headNode2annotation(node);
+ }
+ }
+
+ public void visitEndTag(Tag tag) {
+ if (body == true) {
+ endTag(tag);
+ }
+ }
+
+ public void tag2annotation(Tag tag, String name, CAS cas) {
+ String typeName = HtmlAnnotator.NAMESPACE + name;
+ Type type = cas.getTypeSystem().getType(typeName);
+ if (type == null) {
+ type = cas.getTypeSystem().getType(HtmlAnnotator.NAMESPACE + "TAG");
+ }
+ 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 (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;
+ try {
+ int size = tag.getAttributesEx().size() - 1;
+ attributeName = new StringArray(cas.getJCas(), size);
+ attributeValue = new StringArray(cas.getJCas(), 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()) {
+ AnnotationDelta annotationDelta = new AnnotationDelta(annotation, delta, attributeName,
+ attributeValue, name, stripHtml);
+ annotationList.add(annotationDelta);
+ } else {
+ AnnotationDelta annotationDelta = new AnnotationDelta(annotation, delta, attributeName,
+ attributeValue, name, stripHtml);
+ annotations.add(annotationDelta);
+ }
+ } catch (CASException e) {
+ e.printStackTrace();
+ }
+ }
+
+ 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) {
+ String typeName = HtmlAnnotator.NAMESPACE + name;
+ Type type = cas.getTypeSystem().getType(typeName);
+ if (type == null) {
+ type = cas.getTypeSystem().getType(HtmlAnnotator.NAMESPACE + "TAG");
+ }
+ AnnotationFS annotation = cas.createAnnotation(type, 0, 0);
+ 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());
+ }
+ AnnotationDelta annotationDelta = new AnnotationDelta(annotation, 0, attributeName,
+ attributeValue, name, stripHtml);
+ annotationList.add(annotationDelta);
+
+ }
+
+ public void node2annotation(Remark node) {
+ int position = node.getStartPosition();
+ if (stripHtml) {
+ position -= delta;
+ }
+ String comment = node.getText();
+ Remarks remark = new Remarks(comment, position);
+ remarks.add(remark);
+ delta += node.getEndPosition() - node.getStartPosition();
+ }
+
+ public void headNode2annotation(Remark node) {
+ String comment = node.getText();
+ Remarks remark = new Remarks(comment, 0);
+ remarks.add(remark);
+ }
+
+ public void endTag(Tag endtag) {
+ int size = annotations.size();
+ if (size > 0) {
+ AnnotationDelta 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<AnnotationDelta> getAnnotationList() {
+ return annotationList;
+ }
+
+ public List<Remarks> getRemarks() {
+ return remarks;
+ }
+
+}
Added: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/Remarks.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/Remarks.java?rev=1371195&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/Remarks.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/html/Remarks.java Thu Aug 9 13:17:57 2012
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.engine.html;
+
+public class Remarks {
+ private String comment;
+ private int position;
+
+ public Remarks(String comment, int position){
+ this.comment = comment;
+ this.position = position;
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public int getPosition() {
+ return position;
+ }
+
+}
Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/resource/TreeWordList.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/resource/TreeWordList.java?rev=1371195&r1=1371194&r2=1371195&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/resource/TreeWordList.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/resource/TreeWordList.java Thu Aug 9 13:17:57 2012
@@ -39,7 +39,6 @@ import javax.xml.parsers.SAXParserFactor
import org.apache.uima.cas.FSIterator;
import org.apache.uima.cas.Type;
import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.collection.base_cpm.SkipCasException;
import org.apache.uima.jcas.tcas.Annotation;
import org.apache.uima.textmarker.TextMarkerStream;
import org.apache.uima.textmarker.type.TextMarkerBasic;
Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/seed/SeedLexer.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/seed/SeedLexer.java?rev=1371195&r1=1371194&r2=1371195&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/seed/SeedLexer.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/seed/SeedLexer.java Thu Aug 9 13:17:57 2012
@@ -21,12 +21,8 @@
package org.apache.uima.textmarker.seed;
-import java.util.*;
-import java.util.regex.*;
-
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.jcas.JCas;
-
import org.apache.uima.textmarker.type.AMP;
import org.apache.uima.textmarker.type.BREAK;
import org.apache.uima.textmarker.type.CAP;
Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/DebugCreatedBy.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/DebugCreatedBy.java?rev=1371195&r1=1371194&r2=1371195&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/DebugCreatedBy.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/DebugCreatedBy.java Thu Aug 9 13:17:57 2012
@@ -3,12 +3,11 @@
/* First created by JCasGen Wed Jul 11 15:10:37 CEST 2012 */
package org.apache.uima.textmarker.type;
-import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP;
import org.apache.uima.jcas.cas.TOP_Type;
-
import org.apache.uima.jcas.tcas.Annotation;
-import org.apache.uima.jcas.cas.TOP;
/**
Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/DebugCreatedBy_Type.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/DebugCreatedBy_Type.java?rev=1371195&r1=1371194&r2=1371195&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/DebugCreatedBy_Type.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/DebugCreatedBy_Type.java Thu Aug 9 13:17:57 2012
@@ -2,15 +2,15 @@
/* First created by JCasGen Wed Jul 11 15:10:37 CEST 2012 */
package org.apache.uima.textmarker.type;
-import org.apache.uima.jcas.JCas;
-import org.apache.uima.jcas.JCasRegistry;
-import org.apache.uima.cas.impl.CASImpl;
-import org.apache.uima.cas.impl.FSGenerator;
+import org.apache.uima.cas.Feature;
import org.apache.uima.cas.FeatureStructure;
-import org.apache.uima.cas.impl.TypeImpl;
import org.apache.uima.cas.Type;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FSGenerator;
import org.apache.uima.cas.impl.FeatureImpl;
-import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.jcas.cas.TOP_Type;
/**
Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/TokenSeed.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/TokenSeed.java?rev=1371195&r1=1371194&r2=1371195&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/TokenSeed.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/TokenSeed.java Thu Aug 9 13:17:57 2012
@@ -3,10 +3,9 @@
/* First created by JCasGen Wed Jan 11 14:42:22 CET 2012 */
package org.apache.uima.textmarker.type;
-import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.jcas.cas.TOP_Type;
-
import org.apache.uima.jcas.tcas.Annotation;
Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/TokenSeed_Type.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/TokenSeed_Type.java?rev=1371195&r1=1371194&r2=1371195&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/TokenSeed_Type.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/type/TokenSeed_Type.java Thu Aug 9 13:17:57 2012
@@ -2,13 +2,13 @@
/* First created by JCasGen Wed Jan 11 14:42:22 CET 2012 */
package org.apache.uima.textmarker.type;
-import org.apache.uima.jcas.JCas;
-import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.impl.FSGenerator;
-import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.cas.impl.TypeImpl;
-import org.apache.uima.cas.Type;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.jcas.tcas.Annotation_Type;
/**
Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/verbalize/ScriptVerbalizer.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/verbalize/ScriptVerbalizer.java?rev=1371195&r1=1371194&r2=1371195&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/verbalize/ScriptVerbalizer.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/verbalize/ScriptVerbalizer.java Thu Aug 9 13:17:57 2012
@@ -28,7 +28,6 @@ import org.apache.uima.textmarker.TextMa
import org.apache.uima.textmarker.action.AbstractTextMarkerAction;
import org.apache.uima.textmarker.condition.AbstractTextMarkerCondition;
import org.apache.uima.textmarker.expression.TextMarkerExpression;
-import org.apache.uima.textmarker.expression.type.TypeExpression;
import org.apache.uima.textmarker.rule.ComposedRuleElement;
import org.apache.uima.textmarker.rule.RuleElement;
import org.apache.uima.textmarker.rule.TextMarkerDisjunctiveMatcher;
Added: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/resources/org/apache/uima/textmarker/engine/HtmlAnnotator.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/resources/org/apache/uima/textmarker/engine/HtmlAnnotator.xml?rev=1371195&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/resources/org/apache/uima/textmarker/engine/HtmlAnnotator.xml (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/resources/org/apache/uima/textmarker/engine/HtmlAnnotator.xml Thu Aug 9 13:17:57 2012
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <primitive>true</primitive>
+ <annotatorImplementationName>org.apache.uima.textmarker.engine.html.HtmlAnnotator</annotatorImplementationName>
+ <analysisEngineMetaData>
+ <name>PlainTextAnnotator</name>
+ <description/>
+ <version>1.0</version>
+ <vendor/>
+ <configurationParameters>
+ <configurationParameter>
+ <name>plainTextOutput</name>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>outputViewName</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>onlyContent</name>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ </configurationParameters>
+ <configurationParameterSettings>
+ <nameValuePair>
+ <name>plainTextOutput</name>
+ <value>
+ <boolean>false</boolean>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>onlyContent</name>
+ <value>
+ <boolean>true</boolean>
+ </value>
+ </nameValuePair>
+ </configurationParameterSettings>
+ <typeSystemDescription>
+ <imports>
+ <import location="HtmlTypeSystem.xml"/>
+ </imports>
+ </typeSystemDescription>
+ <typePriorities/>
+ <fsIndexCollection/>
+ <capabilities>
+ <capability>
+ <inputs/>
+ <outputs/>
+ <languagesSupported/>
+ </capability>
+ </capabilities>
+ <operationalProperties>
+ <modifiesCas>true</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>false</outputsNewCASes>
+ </operationalProperties>
+ </analysisEngineMetaData>
+ <resourceManagerConfiguration/>
+</analysisEngineDescription>
Added: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/resources/org/apache/uima/textmarker/engine/HtmlTypeSystem.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/resources/org/apache/uima/textmarker/engine/HtmlTypeSystem.xml?rev=1371195&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/resources/org/apache/uima/textmarker/engine/HtmlTypeSystem.xml (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/resources/org/apache/uima/textmarker/engine/HtmlTypeSystem.xml Thu Aug 9 13:17:57 2012
@@ -0,0 +1,254 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<typeSystemDescription xmlns="http://uima.apache.org/resourceSpecifier">
+ <name>typeSystemDescriptor</name>
+ <description/>
+ <version>1.0</version>
+ <vendor/>
+ <types>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.TAG</name>
+ <description></description>
+ <supertypeName>uima.tcas.Annotation</supertypeName>
+ <features>
+ <featureDescription>
+ <name>name</name>
+ <description></description>
+ <rangeTypeName>uima.cas.String</rangeTypeName>
+ </featureDescription>
+ <featureDescription>
+ <name>attributeName</name>
+ <description></description>
+ <rangeTypeName>uima.cas.StringArray</rangeTypeName>
+ <multipleReferencesAllowed>false</multipleReferencesAllowed>
+ </featureDescription>
+ <featureDescription>
+ <name>attributeValue</name>
+ <description/>
+ <rangeTypeName>uima.cas.StringArray</rangeTypeName>
+ <multipleReferencesAllowed>false</multipleReferencesAllowed>
+ </featureDescription>
+ </features>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.B</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.H1</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.H2</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.H3</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.H4</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.H5</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.H6</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.COMMENT</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.TITLE</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.I</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.U</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.BIG</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.SMALL</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.FONT</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.A</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.HEAD</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.HTML</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.BODY</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.EM</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.TABLE</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.DIV</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.SPAN</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.UL</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.OL</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.P</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.LI</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.TBODY</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.TD</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.TR</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.TH</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.IMG</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.STYLE</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.SCRIPT</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.LINK</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.INPUT</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.FORM</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.META</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.BR</name>
+ <description></description>
+ <supertypeName>org.apache.uima.textmarker.type.html.TAG</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.textmarker.type.html.REMARK</name>
+ <description></description>
+ <supertypeName>uima.tcas.Annotation</supertypeName>
+ <features>
+ <featureDescription>
+ <name>comment</name>
+ <description></description>
+ <rangeTypeName>uima.cas.String</rangeTypeName>
+ </featureDescription>
+ </features>
+ </typeDescription>
+ </types>
+</typeSystemDescription>
Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/action/MarkFastTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/action/MarkFastTest.java?rev=1371195&r1=1371194&r2=1371195&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/action/MarkFastTest.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/action/MarkFastTest.java Thu Aug 9 13:17:57 2012
@@ -21,9 +21,6 @@ package org.apache.uima.textmarker.actio
import static org.junit.Assert.assertEquals;
-import java.util.Map;
-import java.util.TreeMap;
-
import org.apache.uima.cas.CAS;
import org.apache.uima.cas.FSIterator;
import org.apache.uima.cas.Type;
Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/condition/CurrentCountTest.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/condition/CurrentCountTest.java?rev=1371195&r1=1371194&r2=1371195&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/condition/CurrentCountTest.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/test/java/org/apache/uima/textmarker/condition/CurrentCountTest.java Thu Aug 9 13:17:57 2012
@@ -21,9 +21,6 @@ package org.apache.uima.textmarker.condi
import static org.junit.Assert.assertEquals;
-import java.util.Map;
-import java.util.TreeMap;
-
import org.apache.uima.cas.CAS;
import org.apache.uima.cas.FSIterator;
import org.apache.uima.cas.Type;