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/09/06 13:43:01 UTC
svn commit: r1381563 [1/2] - in /uima/sandbox/trunk/TextMarker:
uimaj-ep-textmarker-engine/ uimaj-ep-textmarker-ide/
uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/
uimaj-ep-textmarker-ide/src/main/resources/org/a...
Author: pkluegl
Date: Thu Sep 6 11:43:00 2012
New Revision: 1381563
URL: http://svn.apache.org/viewvc?rev=1381563&view=rev
Log:
UIMA-2285
- show new documentation for actions and conditions on mouse hover in IDE
Added:
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/HtmlDocumentationVisitor.java
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/resources/org/apache/uima/textmarker/ide/ui/documentation/Actions.html
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/resources/org/apache/uima/textmarker/ide/ui/documentation/Conditions.html
Removed:
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/resources/org/apache/uima/textmarker/ide/ui/documentation/ActionDocumentation.txt
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/resources/org/apache/uima/textmarker/ide/ui/documentation/ConditionDocumentation.txt
Modified:
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/pom.xml
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/pom.xml
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/AbstractLanguageElementDocumentationProvider.java
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/TextMarkerActionDocumentationProvider.java
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/TextMarkerConditionDocumentationProvider.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=1381563&r1=1381562&r2=1381563&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/pom.xml (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/pom.xml Thu Sep 6 11:43:00 2012
@@ -95,7 +95,9 @@
org.antlr.stringtemplate.language,
org.antlr.stringtemplate.misc,
antlr,
- antlr.*
+ antlr.*,
+ org.htmlparser,
+ org.htmlparser.*
</_exportcontents>
<Require-Bundle>
org.apache.uima.runtime
Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/pom.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/pom.xml?rev=1381563&r1=1381562&r2=1381563&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/pom.xml (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/pom.xml Thu Sep 6 11:43:00 2012
@@ -248,40 +248,40 @@
</pluginManagement>
<plugins>
- <!-- generate java code for antlr grammars -->
- <plugin>
- <groupId>org.antlr</groupId>
- <artifactId>antlr3-maven-plugin</artifactId>
- <version>3.1.3-1</version>
- <executions>
- <execution>
- <id>run antlr</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>antlr</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${basedir}/target/generated-sources/antlr3
- </source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
+ <!-- generate java code for antlr grammars -->
+ <plugin>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr3-maven-plugin</artifactId>
+ <version>3.1.3-1</version>
+ <executions>
+ <execution>
+ <id>run antlr</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>antlr</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${basedir}/target/generated-sources/antlr3
+ </source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/AbstractLanguageElementDocumentationProvider.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/AbstractLanguageElementDocumentationProvider.java?rev=1381563&r1=1381562&r2=1381563&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/AbstractLanguageElementDocumentationProvider.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/AbstractLanguageElementDocumentationProvider.java Thu Sep 6 11:43:00 2012
@@ -27,11 +27,12 @@ import java.io.Reader;
import java.io.StringReader;
import java.util.HashMap;
import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import org.apache.uima.textmarker.ide.TextMarkerIdePlugin;
import org.eclipse.dltk.core.IMember;
import org.eclipse.dltk.ui.documentation.IScriptDocumentationProvider;
+import org.htmlparser.Parser;
+import org.htmlparser.util.NodeList;
public abstract class AbstractLanguageElementDocumentationProvider implements
IScriptDocumentationProvider {
@@ -74,29 +75,17 @@ public abstract class AbstractLanguageEl
sb.append(line + "\n");
}
- String string = sb.toString();
- string = string.replaceAll("\\[\\{TableOfContents\\}\\]", "");
- String[] split = string.split("[-][-][-][-]");
-
- Pattern compile = Pattern.compile("!! __([A-Z]+)__");
- for (String each : split) {
- String docu = each.trim();
- Matcher matcher = compile.matcher(each);
- String group = null;
- if (matcher.find()) {
- group = matcher.group(1);
- docu = docu.replaceAll("!! __" + group + "__", "<h1>" + group + "</h1>");
- }
- docu = docu.replaceAll("__Definition__", "<h2>Definition</h2>");
- docu = docu.replaceAll("__Example__", "<h2>Example</h2>");
- docu = docu.replaceAll("%%prettify", "");
- docu = docu.replaceAll("/%", "");
- docu = docu.replaceAll("\\{\\{\\{", "<code>");
- docu = docu.replaceAll("\\}\\}\\}", "</code>");
+ String document = sb.toString();
- if (group != null) {
- map.put(group, docu);
- }
+ try {
+ Parser parser = new Parser(document);
+ NodeList list = parser.parse(null);
+ HtmlDocumentationVisitor visitor = new HtmlDocumentationVisitor(document);
+ list.visitAllNodesWith(visitor);
+ map.putAll(visitor.getMap());
+ } catch (Exception e) {
+ TextMarkerIdePlugin.error(e);
}
+
}
}
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/HtmlDocumentationVisitor.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/HtmlDocumentationVisitor.java?rev=1381563&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/HtmlDocumentationVisitor.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/HtmlDocumentationVisitor.java Thu Sep 6 11:43:00 2012
@@ -0,0 +1,86 @@
+/*
+ * 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.ide.ui.documentation;
+
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.htmlparser.Tag;
+import org.htmlparser.visitors.NodeVisitor;
+
+public class HtmlDocumentationVisitor extends NodeVisitor {
+
+ private TreeMap<String, String> map;
+
+ private int divDepth = 0;
+
+ private int elementStart = 0;
+
+ private String document;
+
+ public HtmlDocumentationVisitor(String document) {
+ super();
+ this.document = document;
+ this.map = new TreeMap<String, String>();
+ }
+
+ public void visitTag(Tag tag) {
+ String name = tag.getTagName().toLowerCase();
+ if("div".equals(name)) {
+ divDepth++;
+ if(divDepth == 1) {
+ elementStart = tag.getStartPosition();
+ }
+ }
+
+ }
+ public void visitEndTag(Tag tag) {
+ String name = tag.getTagName().toLowerCase();
+ if("div".equals(name)) {
+ if(divDepth == 1) {
+ String section = document.substring(elementStart, tag.getEndPosition());
+ processSection(section);
+ }
+ divDepth--;
+ }
+
+ }
+
+ private void processSection(String section) {
+ Pattern pattern = Pattern.compile("title=\"\\d+\\.\\d+\\.\\d+\\. (\\p{Upper}+)\"");
+ Matcher matcher = pattern.matcher(section);
+ boolean found = matcher.find();
+ if(found) {
+ String group = matcher.group(1);
+ section = section.trim();
+ section = section.replaceAll("</?a.*>", "");
+ section = section.replaceAll("\\d+\\.\\d+\\.\\d+.\\d+\\. ", "");
+ section = section.replaceAll("\\d+\\.\\d+\\.\\d+. ", "");
+ map.put(group, section);
+ }
+ }
+
+ public Map<String, String> getMap() {
+ return map;
+ }
+
+}
Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/TextMarkerActionDocumentationProvider.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/TextMarkerActionDocumentationProvider.java?rev=1381563&r1=1381562&r2=1381563&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/TextMarkerActionDocumentationProvider.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/TextMarkerActionDocumentationProvider.java Thu Sep 6 11:43:00 2012
@@ -23,7 +23,7 @@ public class TextMarkerActionDocumentati
AbstractLanguageElementDocumentationProvider {
public TextMarkerActionDocumentationProvider() {
- super("ActionDocumentation.txt");
+ super("Actions.html");
}
}
Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/TextMarkerConditionDocumentationProvider.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/TextMarkerConditionDocumentationProvider.java?rev=1381563&r1=1381562&r2=1381563&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/TextMarkerConditionDocumentationProvider.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/ui/documentation/TextMarkerConditionDocumentationProvider.java Thu Sep 6 11:43:00 2012
@@ -23,7 +23,7 @@ public class TextMarkerConditionDocument
AbstractLanguageElementDocumentationProvider {
public TextMarkerConditionDocumentationProvider() {
- super("ConditionDocumentation.txt");
+ super("Conditions.html");
}
}
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/resources/org/apache/uima/textmarker/ide/ui/documentation/Actions.html
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/resources/org/apache/uima/textmarker/ide/ui/documentation/Actions.html?rev=1381563&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/resources/org/apache/uima/textmarker/ide/ui/documentation/Actions.html (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/resources/org/apache/uima/textmarker/ide/ui/documentation/Actions.html Thu Sep 6 11:43:00 2012
@@ -0,0 +1,1078 @@
+ <div class="section" title="2.7.1. ADD"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.add">2.7.1. ADD</h3></div></div></div>
+
+ <p>
+ The ADD action adds all the elements of the passed
+ TextMarkerExpressions to a given list. For example this expressions
+ could be a string, an integer variable or a list itself. For a
+ complete overview on Textmarker expressions see
+ <a class="xref" href="#ugr.tools.tm.language.expressions" title="2.8. Expressions">Section 2.8, “Expressions”</a>
+ .
+ </p>
+ <div class="section" title="2.7.1.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e602">2.7.1.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">ADD(ListVariable,(TextMarkerExpression)+)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.1.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e607">2.7.1.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Document{->ADD(list, var)};</pre><p>
+ </p>
+ <p>
+ In this example, the variable 'var' is added to the list
+ 'list'.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.2. ASSIGN"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.assign">2.7.2. ASSIGN</h3></div></div></div>
+
+ <p>
+ The ASSIGN action assigns the value of the passed expression to
+ a variable of the same type.
+ </p>
+ <div class="section" title="2.7.2.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e616">2.7.2.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">ASSIGN(BooleanVariable,BooleanExpression)</pre><p>
+ </p>
+ <p>
+ </p><pre class="programlisting">ASSIGN(NumberVariable,NumberExpression)</pre><p>
+ </p>
+ <p>
+ </p><pre class="programlisting">ASSIGN(StringVariable,StringExpression)</pre><p>
+ </p>
+ <p>
+ </p><pre class="programlisting">ASSIGN(TypeVariable,TypeExpression)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.2.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e627">2.7.2.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Document{->ASSIGN(amount, (amount/2))};</pre><p>
+ </p>
+ <p>
+ In this example, the value of the variable 'amount' is halved.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.3. CALL"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.call">2.7.3. CALL</h3></div></div></div>
+
+ <p>
+ The CALL action initiates the execution of a different script
+ file or script block. Currently only complete script files are
+ supported.
+ </p>
+ <div class="section" title="2.7.3.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e636">2.7.3.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">CALL(DifferentFile)</pre><p>
+ </p>
+ <p>
+ </p><pre class="programlisting">CALL(Block)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.3.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e643">2.7.3.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Document{->CALL(NamedEntities)};</pre><p>
+ </p>
+ <p>
+ Here, a script 'NamedEntities' for named entity recognition is
+ executed.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.4. CLEAR"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.clear">2.7.4. CLEAR</h3></div></div></div>
+
+ <p>
+ The CLEAR action removes all elements of the given list.
+ </p>
+ <div class="section" title="2.7.4.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e652">2.7.4.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">CLEAR(ListVariable)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.4.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e657">2.7.4.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Document{->CLEAR(SomeList)};</pre><p>
+ </p>
+ <p>
+ This rule clears the list 'SomeList'.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.5. COLOR"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.color">2.7.5. COLOR</h3></div></div></div>
+
+ <p>
+ The COLOR action sets the color of an annotation type in the
+ modified view if the rule is fired. The background color is passed as
+ the second parameter. The font color can be changed by passing a
+ further color as third parameter. By default annotations are not
+ automatically selected when opening the modified view. This can be
+ changed for the matched annotations by passing true as fourth
+ parameter. By default The supported colors are: black, silver, gray,
+ white, maroon, red, purple, fuchsia, green, lime, olive, yellow,
+ navy, blue, aqua, lightblue, lightgreen, orange, pink, salmon, cyan,
+ violet, tan, brown, white, mediumpurple.
+ </p>
+ <div class="section" title="2.7.5.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e666">2.7.5.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">COLOR(TypeExpression,StringExpression(, StringExpression
+ (, BooleanExpression)?)?)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.5.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e671">2.7.5.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Document{->COLOR(Headline, "red", "green", true)};</pre><p>
+ </p>
+ <p>
+ This rule colors all Headline annotations in the modified view.
+ Thereby background color is set to red, font color is set to green
+ and all 'Headline' annotations are selected when opening the
+ modified view.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.6. CONFIGURE"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.configure">2.7.6. CONFIGURE</h3></div></div></div>
+
+ <p>
+ The CONFIGURE action can be used to configure the analysis
+ engine of the given namespace (first parameter). The parameters that
+ should be configured with corresponding values are passed as
+ name-value
+ pairs.
+ </p>
+ <div class="section" title="2.7.6.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e680">2.7.6.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">CONFIGURE(StringExpression(,StringExpression = Expression)+)</pre><p>
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.7. CREATE"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.create">2.7.7. CREATE</h3></div></div></div>
+
+ <p>
+ The CREATE action is similar to the MARK action. It also
+ annotates the matched text fragments with a type annotation, but
+ additionally assigns values to a choosen subset of the type's feature
+ elements.
+ </p>
+ <div class="section" title="2.7.7.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e688">2.7.7.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">CREATE(TypeExpression(,NumberExpression)*(,StringExpression = Expression)+)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.7.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e693">2.7.7.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Paragraph{COUNT(ANY,0,10000,cnt)->CREATE(Headline,"size" = cnt)};</pre><p>
+ </p>
+ <p>
+ This rule counts the number of tokens of type ANY in a
+ Paragraph annotation and assigns the counted value to the int
+ variable 'cnt'. If the counted number is between 0 and 10000, a
+ Headline annotation is created for this Paragraph. Moreover the
+ feature named 'size' of Headline is set to the value of 'cnt'.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.8. DEL"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.del">2.7.8. DEL</h3></div></div></div>
+
+ <p>
+ The DEL action deletes the matched text fragments in the
+ modified
+ view.
+ </p>
+ <div class="section" title="2.7.8.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e702">2.7.8.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">DEL</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.8.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e707">2.7.8.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Name{->DEL};</pre><p>
+ </p>
+ <p>
+ This rule deletes all text fragments that are annotated with a
+ Name annotation.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.9. DYNAMICANCHORING"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.dynamicanchoring">2.7.9. DYNAMICANCHORING</h3></div></div></div>
+
+ <p>
+ The DYNAMICANCHORING action turns dynamic anchoring on or off
+ (first parameter) and assigns the anchoring parameters penalty
+ (sceond parameter) and factor (third parameter).
+ </p>
+ <div class="section" title="2.7.9.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e716">2.7.9.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">DYNAMICANCHORING(BooleanExpression(,NumberExpression(,NumberExpression)?)?)</pre><p>
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.10. EXEC"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.exec">2.7.10. EXEC</h3></div></div></div>
+
+ <p>
+ The EXEC action initiates the execution of a different script
+ file or analysis engine on the complete input document independent of
+ the matched text and the current filtering settings. If the argument
+ refers to another script file, a new view on the document is created:
+ the complete text of the original CAS and with the default filtering
+ settings of the TextMarker analysis engine.
+ </p>
+ <div class="section" title="2.7.10.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e724">2.7.10.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">EXEC(DifferentFile)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.10.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e729">2.7.10.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">ENGINE NamedEntities;
+ Document{->EXEC(NamedEntities)};</pre><p>
+ </p>
+ <p>
+ Here, an analysis engine for named entity recognition is
+ executed once on the complete document
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.11. FILL"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.fill">2.7.11. FILL</h3></div></div></div>
+
+ <p>
+ The FILL action fills a choosen subset of the given type's
+ feature elements.
+ </p>
+ <div class="section" title="2.7.11.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e738">2.7.11.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">FILL(TypeExpression(,StringExpression = Expression)+)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.11.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e743">2.7.11.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Headline{COUNT(ANY,0,10000,tokenCount)
+ ->FILL(Headline,"size" = tokenCount)};</pre><p>
+ </p>
+ <p>
+ Here, the number of tokens within an Headline annotation is
+ counted an stored in variable 'tokenCount'. If the number of tokens
+ is within the interval [0;10000], the FILL action fills the
+ Headline's feature 'size' with the value of 'tokenCount'.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.12. FILTERTYPE"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.filtertype">2.7.12. FILTERTYPE</h3></div></div></div>
+
+ <p>
+ This action filters the given types of annotations. They are now
+ ignored by rules. For more informations on how rules work see
+ <a class="xref" href="#ugr.tools.tm.language.inference" title="2.3. Syntax">Section 2.3, “Syntax”</a>
+ . Expressions are not yet supported. This action is complementary to
+ RETAINTYPE (see
+ <a class="xref" href="#ugr.tools.tm.language.actions.retaintype" title="2.7.29. RETAINTYPE">Section 2.7.29, “RETAINTYPE”</a>
+ ).
+ </p>
+ <div class="section" title="2.7.12.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e754">2.7.12.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">FILTERTYPE((TypeExpression(,TypeExpression)*))?</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.12.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e759">2.7.12.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Document{->FILTERTYPE(SW)};</pre><p>
+ </p>
+ <p>
+ This rule filters all small written words in the input
+ document. This means they are further ignored by any rules.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.13. GATHER"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.gather">2.7.13. GATHER</h3></div></div></div>
+
+ <p>
+ This action creates a complex structure, a annotation with
+ features. The optionally passed indexes (NumberExpressions after the
+ TypeExpression) can be used to create an annotation that spanns the
+ matched information of several rule elements. The features are
+ collected using the indexes of the rule elements of the complete
+ rule.
+ </p>
+ <div class="section" title="2.7.13.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e768">2.7.13.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">GATHER(TypeExpression(,NumberExpression)*
+ (,StringExpression = NumberExpression)+)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.13.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e773">2.7.13.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">DECLARE Annotation A;
+ DECLARE Annotation B;
+ DECLARE Annotation C(Annotation a, Annotation b);
+ W{REGEXP("A")->MARK(A)};
+ W{REGEXP("B")->MARK(B)};
+ A B{-> GATHER(C, 1, 2, "a" = 1, "b" = 2)};</pre><p>
+ </p>
+ <p>
+ Two annotations A and B are declared and annotated. The last
+ rule creates an annotation C spanning the elements A (index 1 since
+ it is the first rule element) and B (index 2) with its features 'a'
+ set to annotation A (again index 1) and 'b' set to annotation B
+ (again index 2).
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.14. GET"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.get">2.7.14. GET</h3></div></div></div>
+
+ <p>
+ The GET action retrieves an element of the given list dependent on a
+ given strategy.
+ </p><div class="table"><a name="d5e782"></a><p class="title"><b>Table 2.1. Currently supported strategies</b></p><div class="table-contents">
+
+ <table summary="Currently supported strategies" style="border-collapse: collapse;border-top: 0.5pt solid black; border-bottom: 0.5pt solid black; border-left: 0.5pt solid black; border-right: 0.5pt solid black; "><colgroup><col><col></colgroup><thead><tr><th style="border-right: 0.5pt solid black; border-bottom: 0.5pt solid black; " align="left">Strategy</th><th style="border-bottom: 0.5pt solid black; " align="left">Functionality</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid black; " align="left">dominant</td><td style="" align="left">finds the most occuring element</td></tr></tbody></table>
+ </div></div><p><br class="table-break">
+ </p>
+ <div class="section" title="2.7.14.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e793">2.7.14.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">GET(ListExpression, Variable, StringExpression)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.14.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e798">2.7.14.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Document{->GET(list, var, "dominant")};</pre><p>
+ </p>
+ <p>
+ In this example, the element of the list 'list' that occurs
+ most is stored in the variable 'var'.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.15. GETFEATURE"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.getfeature">2.7.15. GETFEATURE</h3></div></div></div>
+
+ <p>
+ The GETFEATURE action stores the value of the matched
+ annotation's feature (first paramter) in the given variable (second
+ parameter).
+ </p>
+ <div class="section" title="2.7.15.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e807">2.7.15.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">GETFEATURE(StringExpression, Variable)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.15.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e812">2.7.15.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Document{->GETFEATURE("language", stringVar)};</pre><p>
+ </p>
+ <p>
+ In this example, variable 'stringVar' will contain the value of
+ the feature 'language'.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.16. GETLIST"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.getlist">2.7.16. GETLIST</h3></div></div></div>
+
+ <p>
+ This action retrieves a list of types dependent on a given strategy.
+ </p><div class="table"><a name="d5e821"></a><p class="title"><b>Table 2.2. Currently supported strategies</b></p><div class="table-contents">
+
+ <table summary="Currently supported strategies" style="border-collapse: collapse;border-top: 0.5pt solid black; border-bottom: 0.5pt solid black; border-left: 0.5pt solid black; border-right: 0.5pt solid black; "><colgroup><col><col></colgroup><thead><tr><th style="border-right: 0.5pt solid black; border-bottom: 0.5pt solid black; " align="left">Strategy</th><th style="border-bottom: 0.5pt solid black; " align="left">Functionality</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid black; border-bottom: 0.5pt solid black; " align="left">Types</td><td style="border-bottom: 0.5pt solid black; " align="left">get all types within the matched annotation</td></tr><tr><td style="border-right: 0.5pt solid black; border-bottom: 0.5pt solid black; " align="left">Types:End</td><td style="border-bottom: 0.5pt solid black; " align="left">get all types that end at the same offset as the matched
+ annotation
+ </td></tr><tr><td style="border-right: 0.5pt solid black; " align="left">Types:Begin</td><td style="" align="left">get all types that start at the same offset as the
+ matched
+ annotation
+ </td></tr></tbody></table>
+ </div></div><p><br class="table-break">
+ </p>
+ <div class="section" title="2.7.16.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e838">2.7.16.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">GETLIST(ListVariable, StringExpression)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.16.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e843">2.7.16.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Document{->GETLIST(list, "Types")};</pre><p>
+ </p>
+ <p>
+ Here, a list of all types within the document is created and
+ assigned to list variable 'list'.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.17. LOG"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.log">2.7.17. LOG</h3></div></div></div>
+
+ <p>
+ The LOG action simply writes a log message.
+ </p>
+ <div class="section" title="2.7.17.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e852">2.7.17.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">LOG(StringExpression)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.17.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e857">2.7.17.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Document{->LOG("processed")};</pre><p>
+ </p>
+ <p>
+ This rule writes a log message with the string "processed".
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.18. MARK"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.mark">2.7.18. MARK</h3></div></div></div>
+
+ <p>
+ The MARK action is the most important action in the TextMarker
+ system. It creates a new annotation of the given type. The optionally
+ passed indexes (NumberExpressions after the TypeExpression) can be
+ used to create an annotation that spanns the matched information of
+ several rule elements.
+ </p>
+ <div class="section" title="2.7.18.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e866">2.7.18.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">MARK(TypeExpression(,NumberExpression)*)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.18.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e871">2.7.18.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Freeline Paragraph{->MARK(ParagraphAfterFreeline,1,2)};</pre><p>
+ </p>
+ <p>
+ This rule matches on a free line followed by a Paragraph
+ annotation and annotates both in a single ParagraphAfterFreeline
+ annotation. The two numerical expressions at the end of the mark
+ action state that the matched text of the first and the second rule
+ elements are joined to create the boundaries of the new annotation.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.19. MARKFAST"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.markfast">2.7.19. MARKFAST</h3></div></div></div>
+
+ <p>
+ The MARKFAST action creates annotations of the given type (first
+ parameter) if an element of the passed list (second parameter) occurs
+ within the window of the matched annotation. Thereby the created
+ annotation doesn't cover the whole matched annotation. Instead it
+ only covers the text of the found occurence. The third parameter is
+ optional. It defines if the MARKFAST action should ignore the case,
+ whereby its default value is false. The optional fourth parameter
+ specifies a character threshold for the ignorence of the case. It is
+ only relevant if the ignore-case value is set to true. The last
+ parameter is set to true by default and specifies whether whitespaces
+ in the entries of the dictionary should be ignored. For more
+ information on lists see
+ <a class="xref" href="#ugr.tools.tm.language.declarations.ressource" title="2.5.3. Resources">Section 2.5.3, “Resources”</a>
+ . Additionally to external word lists, string lists variables can be
+ used.
+ </p>
+ <div class="section" title="2.7.19.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e881">2.7.19.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">MARKFAST(TypeExpression,ListExpression(,BooleanExpression
+ (,NumberExpression,(BooleanExpression)?)?)?)</pre><p>
+ </p><pre class="programlisting">MARKFAST(TypeExpression,StringListExpression(,BooleanExpression
+ (,NumberExpression,(BooleanExpression)?)?)?)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.19.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e887">2.7.19.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">WORDLIST FirstNameList = 'FirstNames.txt';
+ DECLARE FirstName;
+ Document{-> MARKFAST(FirstName, FirstNameList, true, 2)};</pre><p>
+ </p>
+ <p>
+ This rule annotates all first names listed in the list
+ 'FirstNameList' within the document and ignores the case if the
+ length of the word
+ is greater than 2.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.20. MARKLAST"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.marklast">2.7.20. MARKLAST</h3></div></div></div>
+
+ <p>
+ The MARKLAST action annotates the last token of the matched
+ annotation with the given type.
+ </p>
+ <div class="section" title="2.7.20.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e896">2.7.20.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">MARKLAST(TypeExpression)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.20.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e901">2.7.20.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Document{->MARKLAST(Last)};</pre><p>
+ </p>
+ <p>
+ This rule annotates the last token of the document with the
+ annotation Last.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.21. MARKONCE"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.markonce">2.7.21. MARKONCE</h3></div></div></div>
+
+ <p>
+ The MARKONCE action has the same functionality as the MARK
+ action, but creates a new annotation only if it does not yet exist.
+ </p>
+ <div class="section" title="2.7.21.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e910">2.7.21.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">MARKONCE(NumberExpression,TypeExpression(,NumberExpression)*)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.21.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e915">2.7.21.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Freeline Paragraph{->MARKONCE(ParagraphAfterFreeline,1,2)};</pre><p>
+ </p>
+ <p>
+ This rule matches on a free line followed by a Paragraph and
+ annotates both in a single ParagraphAfterFreeline annotation if it
+ is not already annotated with ParagraphAfterFreeline annotation. The
+ two numerical expressions at the end of the MARKONCE action state
+ that the matched text of the first and the second rule elements are
+ joined to create the boundaries of the new annotation.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.22. MARKSCORE"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.markscore">2.7.22. MARKSCORE</h3></div></div></div>
+
+ <p>
+ The MARKSCORE action is similar to the MARK action. It also creates a
+ new annotation of the given type, but only if it does not yet exist.
+ The optionally passed indexes (parameters after the TypeExpression)
+ can be used to create an annotation that spanns the matched
+ information of several rule elements. Additionally a score value
+ (first parameter) is added to the heuristic score value of the
+ annotation. For more information on heuristic scores see
+ <a class="xref" href="#ugr.tools.tm.language.score" title="2.11. Heuristic extraction using scoring rules">Section 2.11, “Heuristic extraction using scoring rules”</a>
+ .
+ </p>
+ <div class="section" title="2.7.22.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e925">2.7.22.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">MARKSCORE(NumberExpression,TypeExpression(,NumberExpression)*)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.22.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e930">2.7.22.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Freeline Paragraph{->MARKSCORE(10,ParagraphAfterFreeline,1,2)};</pre><p>
+ </p>
+ <p>
+ This rule matches on a free line followed by a paragraph and
+ annotates both in a single ParagraphAfterFreeline annotation. The
+ two number expressions at the end of the mark action indicate that
+ the matched text of the first and the second rule elements are
+ joined to create the boundaries of the new annotation. Additionally
+ the score '10' is added to the heuristic threshold of this
+ annotation.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.23. MARKTABLE"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.marktable">2.7.23. MARKTABLE</h3></div></div></div>
+
+ <p>
+ The MARKTABLE action creates annotations of the given type (first
+ parameter) if an element of the given column (second parameter) of a
+ passed table (third parameter) occures within the window of the
+ matched annotation. Thereby the created annotation doesn't cover the
+ whole matched annotation. Instead it only covers the text of the
+ found occurence. Optionally the MARKTABLE action is able to assign
+ entries of the given table to features of the created annotation.
+ For
+ more information on tables see
+ <a class="xref" href="#ugr.tools.tm.language.declarations.ressource" title="2.5.3. Resources">Section 2.5.3, “Resources”</a>
+ . Additionally several configuration parameters are possible. (See
+ example.)
+ </p>
+ <div class="section" title="2.7.23.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e940">2.7.23.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">MARKTABLE(TypeExpression, NumberExpression, TableExpression
+ (,BooleanExpression, NumberExpression, StringExpression, NumberExpression)?
+ (,StringExpression = NumberExpression)+)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.23.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e945">2.7.23.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">WORDTABLE TestTable = 'TestTable.csv';
+ DECLARE Annotation Struct(STRING first);
+ Document{-> MARKTABLE(Struct, 1, TestTable, true, 4, ".,-", 2, "first" = 2)};</pre><p>
+ </p>
+ <p>
+ In this example, the whole document is searched for all
+ occurences of the entries of the first column of the given table
+ 'TestTable'. For each occurence an annotation of the type Struct is
+ created and its feature 'first' is filled with the entry of the
+ second column. Moreover the case of the word is ignored if the
+ length of the word exceeds 4. Additionally the chars '.', ',' and
+ '-' are ignored, but at maximum two of them.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.24. MATCHEDTEXT"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.matchedtext">2.7.24. MATCHEDTEXT</h3></div></div></div>
+
+ <p>
+ The MATCHEDTEXT action saves the text of the matched annotation
+ in a passed String variable. The optionally passed indexes can be
+ used to match the text of several rule elements.
+ </p>
+ <div class="section" title="2.7.24.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e954">2.7.24.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">MATCHEDTEXT(StringVariable(,NumberExpression)*)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.24.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e959">2.7.24.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Headline Paragraph{->MATCHEDTEXT(stringVariable,1,2)};</pre><p>
+ </p>
+ <p>
+ The text covered by the Headline (rule elment 1) and the
+ Paragraph (rule elment 2) annotation is saved in variable
+ 'stringVariable'.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.25. MERGE"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.merge">2.7.25. MERGE</h3></div></div></div>
+
+ <p>
+ The MERGE action merges a number of given lists. The first
+ parameter defines if the merge is done as intersection (false) or as
+ union (true). The second parameter is the list variable that will
+ contain the result.
+ </p>
+ <div class="section" title="2.7.25.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e968">2.7.25.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">MERGE(BooleanExpression, ListVariable, ListExpression, (ListExpression)+)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.25.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e973">2.7.25.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Document{->MERGE(false, listVar, list1, list2, list3)};</pre><p>
+ </p>
+ <p>
+ The elements that occur in all three lists will be placed in
+ the list 'listVar'.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.26. REMOVE"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.remove">2.7.26. REMOVE</h3></div></div></div>
+
+ <p>
+ The REMOVE action removes lists or single values from a given
+ list
+ </p>
+ <div class="section" title="2.7.26.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e982">2.7.26.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">REMOVE(ListVariable,(Argument)+)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.26.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e987">2.7.26.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Document{->REMOVE(list, var)};</pre><p>
+ </p>
+ <p>
+ In this example, the variable 'var' is removed from the list
+ 'list'.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.27. REMOVEDUPLICATE"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.removeduplicate">2.7.27. REMOVEDUPLICATE</h3></div></div></div>
+
+ <p>
+ This action removes all duplicates within a given list.
+ </p>
+ <div class="section" title="2.7.27.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e996">2.7.27.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">REMOVEDUPLICATE(ListVariable)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.27.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e1001">2.7.27.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Document{->REMOVEDUPLICATE(list)};</pre><p>
+ </p>
+ <p>
+ Here, all duplicates in list 'list' are removed.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.28. REPLACE"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.replace">2.7.28. REPLACE</h3></div></div></div>
+
+ <p>
+ The REPLACE action replaces the text of all matched annotations with
+ the given StringExpression. It remembers the modification for the
+ matched annotations and shows them in the modified view (see
+ <a class="xref" href="#ugr.tools.tm.views.browser" title="3.7.1. Annotation Browser">Section 3.7.1, “Annotation Browser”</a>
+ ).
+ </p>
+ <div class="section" title="2.7.28.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e1011">2.7.28.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">REPLACE(StringExpression)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.28.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e1016">2.7.28.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">FirstName{->REPLACE("first name")};</pre><p>
+ </p>
+ <p>
+ This rule replaces all first names with the string 'first
+ name'.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.29. RETAINTYPE"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.retaintype">2.7.29. RETAINTYPE</h3></div></div></div>
+
+ <p>
+ The RETAINTYPE action retains the given types. This means that they
+ are now not ignored by rules. This action is complementary to
+ FILTERTYPE (see
+ <a class="xref" href="#ugr.tools.tm.language.actions.filtertype" title="2.7.12. FILTERTYPE">Section 2.7.12, “FILTERTYPE”</a>
+ ).
+ </p>
+ <div class="section" title="2.7.29.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e1026">2.7.29.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">RETAINTYPE((TypeExpression(,TypeExpression)*))?</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.29.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e1031">2.7.29.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Document{->RETAINTYPE(SPACE)};</pre><p>
+ </p>
+ <p>
+ All spaces are retained and can be matched by rules.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.30. SETFEATURE"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.setfeature">2.7.30. SETFEATURE</h3></div></div></div>
+
+ <p>
+ The SETFEATURE action sets the value of a feature of the
+ matched
+ complex structure.
+ </p>
+ <div class="section" title="2.7.30.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e1040">2.7.30.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">SETFEATURE(StringExpression,Expression)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.30.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e1045">2.7.30.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Document{->SETFEATURE("language","en")};</pre><p>
+ </p>
+ <p>
+ Here, the feature 'language' of the input document is set to
+ English.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.31. TRANSFER"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.transfer">2.7.31. TRANSFER</h3></div></div></div>
+
+ <p>
+ The TRANSFER action creates a new feature structure and adds all
+ compatible features of the matched annotation.
+ </p>
+ <div class="section" title="2.7.31.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e1054">2.7.31.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">TRANSFER(TypeExpression)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.31.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e1059">2.7.31.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Document{->TRANSFER(LanguageStorage)};</pre><p>
+ </p>
+ <p>
+ Here, a new feature structure LanguageStorage is created and
+ the compatible features of the Document annotation are copied. E.g.,
+ if LanguageStorage defined a feature named 'language', then the
+ feature value of the Document annotation is copied.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.32. TRIE"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.trie">2.7.32. TRIE</h3></div></div></div>
+
+ <p>
+ The TRIE action uses an external multi tree word list to
+ annotate the matched annotation and provides several configuration
+ parameters.
+ </p>
+ <div class="section" title="2.7.32.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e1068">2.7.32.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">TRIE((String = Type)+,ListExpression,BooleanExpression,NumberExpression,
+ BooleanExpression,NumberExpression,StringExpression)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.32.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e1073">2.7.32.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Document{->TRIE("FirstNames.txt" = FirstName, "Companies.txt" = Company,
+ 'Dictionary.mtwl', true, 4, false, 0, ".,-/")};</pre><p>
+ </p>
+ <p>
+ Here, the dictionary 'Dictionary.mtwl' that contains word lists
+ for first names and companies is used to annotate the document. The
+ words previously contained in the file 'FirstNames.txt' are
+ annotated with the type FirstName and the words in the file
+ 'Companies.txt' with the type Company. The case of the word is
+ ignored if the length of the word exceeds 4. The edit distance is
+ deactivated. The cost of an edit operation can currently not be
+ configured by an argument. The last argument additionally defines
+ several chars that will be ignored.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.33. UNMARK"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.unmark">2.7.33. UNMARK</h3></div></div></div>
+
+ <p>
+ The UNMARK action removes the annotation of the given type
+ overlapping the matched annotation.
+ </p>
+ <div class="section" title="2.7.33.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e1082">2.7.33.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">UNMARK(TypeExpression)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.33.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e1087">2.7.33.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Headline{->UNMARK(Headline)};</pre><p>
+ </p>
+ <p>
+ Here, the headline annotation is removed.
+ </p>
+ </div>
+ </div>
+
+ <div class="section" title="2.7.34. UNMARKALL"><div class="titlepage"><div><div><h3 class="title" id="ugr.tools.tm.language.actions.unmarkall">2.7.34. UNMARKALL</h3></div></div></div>
+
+ <p>
+ The UNMARKALL action removes all the annotations of the given
+ type and all of its descendants overlapping the matched annotation,
+ except the annotation is of at least one type in the passed list.
+ </p>
+ <div class="section" title="2.7.34.1. Definition:"><div class="titlepage"><div><div><h4 class="title" id="d5e1096">2.7.34.1.
+ <span class="bold"><strong>Definition:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">UNMARKALL(TypeExpression, TypeListExpression)</pre><p>
+ </p>
+ </div>
+ <div class="section" title="2.7.34.2. Example:"><div class="titlepage"><div><div><h4 class="title" id="d5e1101">2.7.34.2.
+ <span class="bold"><strong>Example:</strong></span>
+ </h4></div></div></div>
+
+ <p>
+ </p><pre class="programlisting">Annotation{->UNMARKALL(Annotation, {Headline})};</pre><p>
+ </p>
+ <p>
+ Here, all annotations but headlines are removed.
+ </p>
+ </div>