Commit a5478e87f35d853f3990868ba856e566fd61e655
1 parent
da9ef80d
id mapping in xml-based files
Showing
4 changed files
with
27 additions
and
5 deletions
conf/parser/mtas/iso_tei.xml
... | ... | @@ -59,6 +59,14 @@ |
59 | 59 | <item type="text" filter="ascii,lowercase" /> |
60 | 60 | </post> |
61 | 61 | </token> |
62 | + <token type="string" offset="false" realoffset="false" parent="true"> | |
63 | + <pre> | |
64 | + <item type="string" value="w.id" /> | |
65 | + </pre> | |
66 | + <post> | |
67 | + <item type="attribute" name="#" /> | |
68 | + </post> | |
69 | + </token> | |
62 | 70 | </mapping> |
63 | 71 | <mapping type="word" name="anchor" start="synch" end="synch"> |
64 | 72 | <token type="string" offset="false" realoffset="false" parent="false"> |
... | ... | @@ -132,6 +140,15 @@ |
132 | 140 | <item type="name" /> |
133 | 141 | </pre> |
134 | 142 | </token> |
143 | + <token type="string" offset="false" realoffset="false" parent="true"> | |
144 | + <pre> | |
145 | + <item type="name" /> | |
146 | + <item type="string" value=".id" /> | |
147 | + </pre> | |
148 | + <post> | |
149 | + <item type="attribute" name="#" /> | |
150 | + </post> | |
151 | + </token> | |
135 | 152 | </mapping> |
136 | 153 | <!-- END GROUPS --> |
137 | 154 | |
... | ... |
docker/Dockerfile
1 | 1 | # Automatically generated Dockerfile |
2 | -# - Build 2016-12-16 11:24 | |
2 | +# - Build 2016-12-16 12:13 | |
3 | 3 | # - Lucene/Solr version 6.3.0 |
4 | 4 | # - Mtas release 20161216 |
5 | 5 | # |
... | ... | @@ -54,7 +54,7 @@ RUN apt-get update && apt-get install -y lsof software-properties-common python- |
54 | 54 | && chmod -R 755 /var/www/html \ |
55 | 55 | && printf "echo\n" >> /start.sh \ |
56 | 56 | && printf "echo \"================ Mtas -- Multi Tier Annotation Search =================\"\n" >> /start.sh \ |
57 | -&& printf "echo \" Timestamp 2016-12-16 11:24\"\n" >> /start.sh \ | |
57 | +&& printf "echo \" Timestamp 2016-12-16 12:13\"\n" >> /start.sh \ | |
58 | 58 | && printf "echo \" Lucene/Solr version 6.3.0\"\n" >> /start.sh \ |
59 | 59 | && printf "echo \" Mtas release 20161216\"\n" >> /start.sh \ |
60 | 60 | && printf "echo \" See https://meertensinstituut.github.io/mtas/ for more information\"\n" >> /start.sh \ |
... | ... |
src/mtas/analysis/parser/MtasBasicParser.java
... | ... | @@ -772,7 +772,7 @@ abstract public class MtasBasicParser extends MtasParser { |
772 | 772 | // directly |
773 | 773 | if (mappingValue.get("source").equals(MtasParserMapping.SOURCE_STRING)) { |
774 | 774 | if (mappingValue.get("type") |
775 | - .equals(MtasParserMapping.PARSER_TYPE_STRING)) { | |
775 | + .equals(MtasParserMapping.PARSER_TYPE_STRING)) { | |
776 | 776 | String subvalue = computeFilteredPrefixedValue( |
777 | 777 | mappingValue.get("type"), mappingValue.get("text"), null, null); |
778 | 778 | if (subvalue != null) { |
... | ... | @@ -805,9 +805,15 @@ abstract public class MtasBasicParser extends MtasParser { |
805 | 805 | // add attribute to value |
806 | 806 | } else if (mappingValue.get("type") |
807 | 807 | .equals(MtasParserMapping.PARSER_TYPE_ATTRIBUTE)) { |
808 | + String tmpValue = null; | |
809 | + if(mappingValue.get("name").equals("#")) { | |
810 | + tmpValue = checkObjects[0].getId(); | |
811 | + } else { | |
812 | + tmpValue = checkObjects[0].getAttribute(mappingValue.get("name")); | |
813 | + } | |
808 | 814 | String subvalue = computeFilteredPrefixedValue( |
809 | 815 | mappingValue.get("type"), |
810 | - checkObjects[0].getAttribute(mappingValue.get("name")), | |
816 | + tmpValue, | |
811 | 817 | mappingValue.get("filter"), |
812 | 818 | value.equals("") ? null : mappingValue.get("prefix")); |
813 | 819 | if (subvalue != null) { |
... | ... |
src/mtas/analysis/parser/MtasXMLParser.java
... | ... | @@ -15,7 +15,6 @@ import javax.xml.stream.XMLStreamConstants; |
15 | 15 | import javax.xml.stream.XMLStreamException; |
16 | 16 | import javax.xml.stream.XMLStreamReader; |
17 | 17 | |
18 | -import mtas.analysis.parser.MtasBasicParser.MtasParserMapping; | |
19 | 18 | import mtas.analysis.token.MtasToken; |
20 | 19 | import mtas.analysis.token.MtasTokenCollection; |
21 | 20 | import mtas.analysis.util.MtasConfigException; |
... | ... |