Format sourcecode
Change-Id: Ia0451e1da8905fc8af6da572d0d717c08bd4f836
diff --git a/src/main/java/de/ids_mannheim/korap/KrillCollection.java b/src/main/java/de/ids_mannheim/korap/KrillCollection.java
index 032b817..ae09adc 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillCollection.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillCollection.java
@@ -492,8 +492,8 @@
};
// Remove deleted docs
- return (DocIdSet) BitsFilteredDocIdSet.wrap((DocIdSet) new BitDocIdSet(bitset),
- acceptDocs);
+ return (DocIdSet) BitsFilteredDocIdSet.wrap((DocIdSet) new BitDocIdSet(
+ bitset), acceptDocs);
};
diff --git a/src/main/java/de/ids_mannheim/korap/KrillIndex.java b/src/main/java/de/ids_mannheim/korap/KrillIndex.java
index e1dc6c3..26b5dad 100644
--- a/src/main/java/de/ids_mannheim/korap/KrillIndex.java
+++ b/src/main/java/de/ids_mannheim/korap/KrillIndex.java
@@ -687,31 +687,31 @@
* @return The number of the occurrences.
* @throws IOException
*/
- /*
+ /*
@Deprecated
public long numberOf (Bits docvec, String field, String type)
- throws IOException {
- // Shortcut for documents
- if (type.equals("documents")) {
- FixedBitSet os = (FixedBitSet) docvec;
- return os.cardinality();
- };
-
- Term term = new Term(field, "-:" + type);
-
- int occurrences = 0;
- try {
- for (LeafReaderContext atomic : this.reader().leaves()) {
- occurrences += this._numberOfAtomic(docvec, atomic, term);
- };
- }
- catch (IOException e) {
- log.warn(e.getLocalizedMessage());
- };
-
- return occurrences;
+ throws IOException {
+ // Shortcut for documents
+ if (type.equals("documents")) {
+ FixedBitSet os = (FixedBitSet) docvec;
+ return os.cardinality();
};
-*/
+
+ Term term = new Term(field, "-:" + type);
+
+ int occurrences = 0;
+ try {
+ for (LeafReaderContext atomic : this.reader().leaves()) {
+ occurrences += this._numberOfAtomic(docvec, atomic, term);
+ };
+ }
+ catch (IOException e) {
+ log.warn(e.getLocalizedMessage());
+ };
+
+ return occurrences;
+ };
+ */
// Search for meta information in term vectors
diff --git a/src/main/java/de/ids_mannheim/korap/collection/BooleanGroupFilter.java b/src/main/java/de/ids_mannheim/korap/collection/BooleanGroupFilter.java
index 1e5c878..2143664 100644
--- a/src/main/java/de/ids_mannheim/korap/collection/BooleanGroupFilter.java
+++ b/src/main/java/de/ids_mannheim/korap/collection/BooleanGroupFilter.java
@@ -121,6 +121,7 @@
return buffer.append(')').toString();
};
+
/*
@Override
public String toString (String str) {
@@ -167,7 +168,8 @@
log.debug("- Filter to allow all documents");
bitset.set(0, maxDoc);
- return BitsFilteredDocIdSet.wrap(new BitDocIdSet(bitset), acceptDocs);
+ return BitsFilteredDocIdSet.wrap(
+ new BitDocIdSet(bitset), acceptDocs);
};
// There is no possible match
diff --git a/src/main/java/de/ids_mannheim/korap/index/Indexer.java b/src/main/java/de/ids_mannheim/korap/index/Indexer.java
index 33e5eb2..9c528a7 100644
--- a/src/main/java/de/ids_mannheim/korap/index/Indexer.java
+++ b/src/main/java/de/ids_mannheim/korap/index/Indexer.java
@@ -128,9 +128,9 @@
case "-d":
path = argv[i + 1];
break;
- default:
- last = true;
- break;
+ default:
+ last = true;
+ break;
};
if (last)
diff --git a/src/main/java/de/ids_mannheim/korap/index/MultiTermTokenStream.java b/src/main/java/de/ids_mannheim/korap/index/MultiTermTokenStream.java
index 02f0d5e..32e3242 100644
--- a/src/main/java/de/ids_mannheim/korap/index/MultiTermTokenStream.java
+++ b/src/main/java/de/ids_mannheim/korap/index/MultiTermTokenStream.java
@@ -416,7 +416,7 @@
// There is payload in the MultiTerm
if (mt.payload != null) {
-
+
payload.put(mt.payload.bytes);
if (DEBUG)
@@ -428,14 +428,9 @@
if (payload.position() > 0) {
if (payload.hasArray()) {
- payloadAttr.setPayload(
- new BytesRef(
- Arrays.copyOfRange(payload.array(),
- payload.arrayOffset(),
- payload.arrayOffset() + payload.position()
- )
- )
- );
+ payloadAttr.setPayload(new BytesRef(Arrays.copyOfRange(
+ payload.array(), payload.arrayOffset(),
+ payload.arrayOffset() + payload.position())));
}
else {
log.error("This should never happen!");
diff --git a/src/main/java/de/ids_mannheim/korap/index/TermInfo.java b/src/main/java/de/ids_mannheim/korap/index/TermInfo.java
index 684b020..47224dd 100644
--- a/src/main/java/de/ids_mannheim/korap/index/TermInfo.java
+++ b/src/main/java/de/ids_mannheim/korap/index/TermInfo.java
@@ -31,7 +31,7 @@
private byte depth = (byte) 0;
private Pattern prefixRegex = Pattern
- .compile("(?:([^/]+)/)?([^:/]+)(?::(.+?))?");
+ .compile("(?:([^/]+)/)?([^:/]+)(?::(.+?))?");
private Matcher matcher;
@@ -54,40 +54,40 @@
// TODO: Use PTI!
switch (tterm.charAt(0)) {
- case '<':
- // "<>:mate/l:..."
- if (tterm.charAt(1) == '>') {
- // span
- this.type = "span";
- tterm = tterm.substring(3);
- ttype = 2;
- }
- // rel-target
- else {
- this.type = "relTarget";
+ case '<':
+ // "<>:mate/l:..."
+ if (tterm.charAt(1) == '>') {
+ // span
+ this.type = "span";
+ tterm = tterm.substring(3);
+ ttype = 2;
+ }
+ // rel-target
+ else {
+ this.type = "relTarget";
+ tterm = tterm.substring(2);
+ ttype = 3;
+ }
+ ;
+ break;
+
+ case '>':
+ // rel-src
+ this.type = "relSrc";
tterm = tterm.substring(2);
ttype = 3;
- }
- ;
- break;
+ break;
- case '>':
- // rel-src
- this.type = "relSrc";
- tterm = tterm.substring(2);
- ttype = 3;
- break;
+ case '_':
+ // pos
+ this.type = "pos";
+ ttype = 1;
+ tterm = tterm.substring(1);
+ break;
- case '_':
- // pos
- this.type = "pos";
- ttype = 1;
- tterm = tterm.substring(1);
- break;
-
- default:
- // term
- this.type = "term";
+ default:
+ // term
+ this.type = "term";
};
// Analyze term value
@@ -227,7 +227,7 @@
@Override
- public int compareTo (TermInfo obj) {
+ public int compareTo (TermInfo obj) {
this.analyze();
obj.analyze();
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/AttributeSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/AttributeSpans.java
index 9dcdbd5..4958bea 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/AttributeSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/AttributeSpans.java
@@ -50,15 +50,16 @@
private int currentDoc, currentPosition;
private boolean isFinish;
- public static enum PayloadTypeIdentifier {
- TERM_ATTRIBUTE(16), ELEMENT_ATTRIBUTE(17), RELATION_ATTRIBUTE(18);
+ public static enum PayloadTypeIdentifier {
+ TERM_ATTRIBUTE(16), ELEMENT_ATTRIBUTE(17), RELATION_ATTRIBUTE(18);
- private int value;
+ private int value;
- private PayloadTypeIdentifier(int value) {
- this.value = value;
- }
- }
+
+ private PayloadTypeIdentifier (int value) {
+ this.value = value;
+ }
+ }
protected Logger logger = LoggerFactory.getLogger(AttributeSpans.class);
@@ -164,25 +165,25 @@
*/
private CandidateAttributeSpan createCandidateSpan () throws IOException {
List<byte[]> payload = (List<byte[]>) firstSpans.getPayload();
- ByteBuffer payloadBuffer = ByteBuffer.wrap(payload.get(0));
+ ByteBuffer payloadBuffer = ByteBuffer.wrap(payload.get(0));
- byte payloadTypeIdentifier = payloadBuffer.get(0);
- short spanId = payloadBuffer.getShort(5);
- // if (payload.get(0).length == 6) {
- int end = payloadBuffer.getInt(1);
+ byte payloadTypeIdentifier = payloadBuffer.get(0);
+ short spanId = payloadBuffer.getShort(5);
+ // if (payload.get(0).length == 6) {
+ int end = payloadBuffer.getInt(1);
- return new CandidateAttributeSpan(firstSpans, payloadTypeIdentifier,
- spanId, end);
+ return new CandidateAttributeSpan(firstSpans, payloadTypeIdentifier,
+ spanId, end);
- // }
- // else if (payload.get(0).length == 10) {
- // start = wrapper.getInt(0);
- // end = wrapper.getInt(4);
- // spanId = wrapper.getShort(8);
- // return new CandidateAttributeSpan(firstSpans, spanId, start, end);
- // }
+ // }
+ // else if (payload.get(0).length == 10) {
+ // start = wrapper.getInt(0);
+ // end = wrapper.getInt(4);
+ // spanId = wrapper.getShort(8);
+ // return new CandidateAttributeSpan(firstSpans, spanId, start, end);
+ // }
- // throw new NullPointerException("Missing element end in payloads.");
+ // throw new NullPointerException("Missing element end in payloads.");
}
@@ -266,23 +267,23 @@
* belongs to.
* @throws IOException
*/
- public CandidateAttributeSpan(Spans span, byte payloadTypeIdenfitier,
- short spanId, int elementEnd)
+ public CandidateAttributeSpan (Spans span, byte payloadTypeIdenfitier,
+ short spanId, int elementEnd)
throws IOException {
super(span);
- this.spanId = spanId;
+ this.spanId = spanId;
this.end = elementEnd;
- this.payloadTypeIdentifier = payloadTypeIdenfitier;
+ this.payloadTypeIdentifier = payloadTypeIdenfitier;
}
- // public CandidateAttributeSpan (Spans span, short spanId, int start,
- // int end) throws IOException {
- // super(span);
- // setSpanId(spanId);
- // this.start = start;
- // this.end = end;
- // }
+ // public CandidateAttributeSpan (Spans span, short spanId, int start,
+ // int end) throws IOException {
+ // super(span);
+ // setSpanId(spanId);
+ // this.start = start;
+ // this.end = end;
+ // }
@Override
public int compareTo (CandidateSpan o) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/CandidateSpan.java b/src/main/java/de/ids_mannheim/korap/query/spans/CandidateSpan.java
index 7490dec..b132dc7 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/CandidateSpan.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/CandidateSpan.java
@@ -23,14 +23,15 @@
private int position;
private CandidateSpan childSpan; // used for example for multiple distance
// with unordered constraint
- protected short spanId;
- protected boolean hasSpanId;
+ protected short spanId;
+ protected boolean hasSpanId;
private short leftId, rightId;
private int leftStart, leftEnd;
private int rightStart, rightEnd;
- protected byte payloadTypeIdentifier;
+ protected byte payloadTypeIdentifier;
+
/**
* Constructs a CandidateSpan for the given Span.
@@ -52,11 +53,11 @@
if (span instanceof SimpleSpans) {
SimpleSpans temp = (SimpleSpans) span;
this.spanId = temp.getSpanId();
- this.hasSpanId = temp.hasSpanId;
+ this.hasSpanId = temp.hasSpanId;
}
else if (span instanceof ClassSpans) {
this.spanId = ((ClassSpans) span).getNumber();
- this.hasSpanId = true;
+ this.hasSpanId = true;
}
}
@@ -301,8 +302,8 @@
*/
public void setSpanId (short spanId) {
this.spanId = spanId;
- if (spanId > 0)
- this.hasSpanId = true;
+ if (spanId > 0)
+ this.hasSpanId = true;
}
@@ -366,15 +367,17 @@
}
- public byte getPayloadTypeIdentifier() {
- return payloadTypeIdentifier;
- }
+ public byte getPayloadTypeIdentifier () {
+ return payloadTypeIdentifier;
+ }
- public void setPayloadTypeIdentifier(byte payloadTypeIdentifier) {
- this.payloadTypeIdentifier = payloadTypeIdentifier;
- }
- @Override
+ public void setPayloadTypeIdentifier (byte payloadTypeIdentifier) {
+ this.payloadTypeIdentifier = payloadTypeIdentifier;
+ }
+
+
+ @Override
public int compareTo (CandidateSpan o) {
if (this.doc == o.doc) {
if (this.getStart() == o.getStart()) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ClassFilteredSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ClassFilteredSpans.java
index b785d2e..71e8e42 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ClassFilteredSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ClassFilteredSpans.java
@@ -56,7 +56,8 @@
private boolean isClassOperationValid () throws IOException {
setBitsets();
- int cardinality = Math.max(bitset1.cardinality(), bitset2.cardinality());
+ int cardinality = Math
+ .max(bitset1.cardinality(), bitset2.cardinality());
bitset1.and(bitset2);
// System.out.println("cardinality:" + cardinality);
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ClassSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ClassSpans.java
index 679b430..47a6998 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ClassSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ClassSpans.java
@@ -143,11 +143,11 @@
};
// Todo: Better allocate using a Factory!
- ByteBuffer bb = ByteBuffer.allocate(10);
- bb.put((byte) 0);
- bb.putInt(spans.start());
- bb.putInt(spans.end());
- bb.put(number);
+ ByteBuffer bb = ByteBuffer.allocate(10);
+ bb.put((byte) 0);
+ bb.putInt(spans.start());
+ bb.putInt(spans.end());
+ bb.put(number);
/*
System.err.println(
"####################### " +
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/DistanceExclusionSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/DistanceExclusionSpans.java
index d3b9f6f..f6cd732 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/DistanceExclusionSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/DistanceExclusionSpans.java
@@ -42,8 +42,7 @@
* @throws IOException
*/
public DistanceExclusionSpans (SpanDistanceQuery query,
- LeafReaderContext context,
- Bits acceptDocs,
+ LeafReaderContext context, Bits acceptDocs,
Map<Term, TermContext> termContexts)
throws IOException {
super(query, context, acceptDocs, termContexts);
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java
index 4a697f4..8227bda 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ElementSpans.java
@@ -20,38 +20,41 @@
import de.ids_mannheim.korap.query.SpanElementQuery;
/**
- * Enumeration of spans representing elements such as phrases, sentences and
+ * Enumeration of spans representing elements such as phrases,
+ * sentences and
* paragraphs. Span length is stored as a payload.
*
- * Depth and certainty value payloads have not been loaded and handled yet.
+ * Depth and certainty value payloads have not been loaded and handled
+ * yet.
*
* @author margaretha
* @author diewald
*/
public final class ElementSpans extends SimpleSpans {
private final TermSpans termSpans;
- private boolean isPayloadLoaded;
+ private boolean isPayloadLoaded;
private final Logger log = LoggerFactory.getLogger(ElementSpans.class);
// This advices the java compiler to ignore all loggings
public static final boolean DEBUG = false;
private byte[] b = new byte[10];
-
- public static enum PayloadTypeIdentifier {
- ELEMENT(64),
+
+ public static enum PayloadTypeIdentifier {
+ ELEMENT(64),
// ELEMENT_WITH_TUI(65),
// ELEMENT_WITH_CERTAINTY_VALUE (66),
// ELEMENT_WITH_TUI_AND_CERTAINTY_VALUE (67),
MILESTONE(65);
-
+
private byte value;
+
private PayloadTypeIdentifier (int value) {
this.value = (byte) value;
- }
+ }
}
-
+
/**
* Constructs ElementSpans for the given {@link SpanElementQuery}.
@@ -73,8 +76,8 @@
throws IOException {
super(spanElementQuery, context, acceptDocs, termContexts);
termSpans = (TermSpans) this.firstSpans;
- hasMoreSpans = true;
- // termSpans.next();
+ hasMoreSpans = true;
+ // termSpans.next();
};
@@ -82,21 +85,22 @@
public boolean next () throws IOException {
if (!hasMoreSpans || !(hasMoreSpans = termSpans.next()))
return false;
-
- isStartEnumeration = false;
- this.matchPayload = null;
- matchEndPosition = -1;
- return advance();
- };
- private boolean advance() throws IOException {
-
+ isStartEnumeration = false;
+ this.matchPayload = null;
+ matchEndPosition = -1;
+ return advance();
+ };
- this.matchStartPosition = termSpans.start();
- this.matchDocNumber = termSpans.doc();
- isPayloadLoaded = false;
- return true;
- };
+
+ private boolean advance () throws IOException {
+
+
+ this.matchStartPosition = termSpans.start();
+ this.matchDocNumber = termSpans.doc();
+ isPayloadLoaded = false;
+ return true;
+ };
/*
@@ -106,48 +110,48 @@
* solely based on their starting and doc position.
*/
private void loadPayload () {
- if (this.isPayloadLoaded) {
+ if (this.isPayloadLoaded) {
return;
- }
- else{
- this.isPayloadLoaded = true;
- }
+ }
+ else {
+ this.isPayloadLoaded = true;
+ }
- List<byte[]> payload;
+ List<byte[]> payload;
try {
- payload = (List<byte[]>) termSpans.getPayload();
+ payload = (List<byte[]>) termSpans.getPayload();
}
catch (IOException e) {
- // silently setting empty element and payload
+ // silently setting empty element and payload
this.matchEndPosition = this.matchStartPosition;
this.setSpanId((short) -1);
- this.hasSpanId = false;
+ this.hasSpanId = false;
this.matchPayload = null;
return;
- }
+ }
- if (!payload.isEmpty()) {
+ if (!payload.isEmpty()) {
// Get payload one by one
final int length = payload.get(0).length;
final ByteBuffer bb = ByteBuffer.allocate(length);
bb.put(payload.get(0));
-
- this.payloadTypeIdentifier = bb.get(0);
- this.matchEndPosition = bb.getInt(9);
+
+ this.payloadTypeIdentifier = bb.get(0);
+ this.matchEndPosition = bb.getInt(9);
if (payloadTypeIdentifier == PayloadTypeIdentifier.ELEMENT.value
&& length > 15) {
- this.setSpanId(bb.getShort(14));
- this.hasSpanId = true;
- }
+ this.setSpanId(bb.getShort(14));
+ this.hasSpanId = true;
+ }
else {
this.setSpanId((short) -1);
- this.hasSpanId = false;
+ this.hasSpanId = false;
}
- // FIX ME
- // Copy the start and end character offsets
+ // FIX ME
+ // Copy the start and end character offsets
// b = Arrays.copyOfRange(bb.array(), 1, 9);
// this.matchPayload = Collections.singletonList(b);
this.matchPayload = Collections.singletonList(bb.array());
@@ -156,7 +160,7 @@
this.matchEndPosition = this.matchStartPosition;
this.setSpanId((short) -1);
- this.hasSpanId = false;
+ this.hasSpanId = false;
this.matchPayload = null;
};
@@ -197,7 +201,7 @@
if (hasMoreSpans && firstSpans.doc() < target
&& firstSpans.skipTo(target)) {
- return this.advance();
+ return this.advance();
};
hasMoreSpans = false;
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedExclusionSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedExclusionSpans.java
index b510282..4d64921 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedExclusionSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedExclusionSpans.java
@@ -62,8 +62,7 @@
* @throws IOException
*/
public ExpandedExclusionSpans (SpanExpansionQuery spanExpansionQuery,
- LeafReaderContext context,
- Bits acceptDocs,
+ LeafReaderContext context, Bits acceptDocs,
Map<Term, TermContext> termContexts)
throws IOException {
super(spanExpansionQuery, context, acceptDocs, termContexts);
@@ -332,9 +331,9 @@
* @return a byte array of extension offsets and class number
*/
private byte[] createExtensionPayloads (int start, int end) {
- ByteBuffer buffer = ByteBuffer.allocate(10);
- Byte classPTI = 0;
- buffer.put(classPTI);
+ ByteBuffer buffer = ByteBuffer.allocate(10);
+ Byte classPTI = 0;
+ buffer.put(classPTI);
buffer.putInt(start);
buffer.putInt(end);
buffer.put(classNumber);
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedSpans.java
index 14d9746..b31abb6 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ExpandedSpans.java
@@ -176,9 +176,9 @@
* @return a byte array of extension offsets and the class number
*/
private byte[] createExtensionPayloads (int start, int end) {
- ByteBuffer buffer = ByteBuffer.allocate(10);
- Byte classPTI = 0;
- buffer.put(classPTI);
+ ByteBuffer buffer = ByteBuffer.allocate(10);
+ Byte classPTI = 0;
+ buffer.put(classPTI);
buffer.putInt(start);
buffer.putInt(end);
buffer.put(classNumber);
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/FocusSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/FocusSpans.java
index f5caa29..9049ddb 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/FocusSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/FocusSpans.java
@@ -167,7 +167,7 @@
// this may be problematic for other calculated payloads!
if ((!matchTemporaryClass && payload.length == 10)
- || (matchTemporaryClass && payload.length == 11)) {
+ || (matchTemporaryClass && payload.length == 11)) {
if (payload[0] == 0) {
if (classNumbers.contains(payload[9])) {
@@ -188,7 +188,7 @@
continue;
};
}
- }
+ }
// Remove span elements
else if (payload[0] == (byte) 64) {
@@ -196,7 +196,7 @@
};
if (//payload.length == 8 ||
- (removeTemporaryClasses && payload.length == 11)) {
+ (removeTemporaryClasses && payload.length == 11)) {
continue;
}
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/ReferenceSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/ReferenceSpans.java
index e17bdcf..9ab35e1 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/ReferenceSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/ReferenceSpans.java
@@ -17,9 +17,8 @@
private byte classNum;
- public ReferenceSpans (SpanReferenceQuery query,
- LeafReaderContext context, Bits acceptDocs,
- Map<Term, TermContext> termContexts)
+ public ReferenceSpans (SpanReferenceQuery query, LeafReaderContext context,
+ Bits acceptDocs, Map<Term, TermContext> termContexts)
throws IOException {
super(query, context, acceptDocs, termContexts);
this.classNum = query.getClassNum();
@@ -51,10 +50,10 @@
matchPayload.clear();
for (byte[] payload : firstSpans.getPayload()) {
- if (payload.length == 10 && payload[9] == classNum) {
+ if (payload.length == 10 && payload[9] == classNum) {
if (isFound) {
- if (start == byte2int(payload, 1)
- && end == byte2int(payload, 5)) {
+ if (start == byte2int(payload, 1)
+ && end == byte2int(payload, 5)) {
match = true;
continue;
}
@@ -62,8 +61,8 @@
break;
}
- start = byte2int(payload, 1);
- end = byte2int(payload, 5);
+ start = byte2int(payload, 1);
+ end = byte2int(payload, 5);
isFound = true;
matchPayload.add(payload);
}
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java
index c8306ea..572528e 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/RelationSpans.java
@@ -66,11 +66,13 @@
private byte value;
+
private PayloadTypeIdentifier (int value) {
this.value = (byte) value;
}
}
+
/**
* Constructs RelationSpans from the given
* {@link SpanRelationQuery}.
@@ -127,8 +129,8 @@
this.matchEndPosition = cs.getEnd();
this.matchPayload = cs.getPayloads();
this.setRightStart(cs.getRightStart());
- this.setRightEnd(cs.getRightEnd());
- this.spanId = cs.getSpanId(); // relation id
+ this.setRightEnd(cs.getRightEnd());
+ this.spanId = cs.getSpanId(); // relation id
this.leftId = cs.getLeftId();
this.rightId = cs.getRightId();
candidateList.remove(0);
@@ -156,8 +158,7 @@
while (hasMoreSpans && relationTermSpan.doc() == currentDoc
&& relationTermSpan.start() == currentPosition) {
- CandidateSpan cs = new CandidateSpan(
- relationTermSpan);
+ CandidateSpan cs = new CandidateSpan(relationTermSpan);
readPayload(cs);
setPayload(cs);
candidateList.add(cs);
@@ -177,7 +178,7 @@
* @param cs
* a CandidateRelationSpan
*/
- private void readPayload(CandidateSpan cs) {
+ private void readPayload (CandidateSpan cs) {
List<byte[]> payload = (List<byte[]>) cs.getPayloads();
int length = payload.get(0).length;
ByteBuffer bb = ByteBuffer.allocate(length);
@@ -187,28 +188,28 @@
int i;
this.payloadTypeIdentifier = bb.get(0);
-
- if (payloadTypeIdentifier == PayloadTypeIdentifier.TERM_TO_TERM.value){ // length 11
+
+ if (payloadTypeIdentifier == PayloadTypeIdentifier.TERM_TO_TERM.value) { // length 11
i = bb.getInt(1);
cs.setLeftEnd(cs.start + 1);
cs.setRightStart(i);
cs.setRightEnd(i + 1);
- cs.setLeftId(bb.getShort(5)); // left id
- cs.setRightId(bb.getShort(7)); // right id
- if (length > 9) {
- cs.setSpanId(bb.getShort(9)); // relation id
- }
+ cs.setLeftId(bb.getShort(5)); // left id
+ cs.setRightId(bb.getShort(7)); // right id
+ if (length > 9) {
+ cs.setSpanId(bb.getShort(9)); // relation id
+ }
}
else if (payloadTypeIdentifier == PayloadTypeIdentifier.TERM_TO_ELEMENT.value) { // length
// 15
cs.setLeftEnd(cs.start + 1);
cs.setRightStart(bb.getInt(1));
cs.setRightEnd(bb.getInt(5));
- cs.setLeftId(bb.getShort(9)); // left id
- cs.setRightId(bb.getShort(11)); // right id
- if (length > 13) {
- cs.setSpanId(bb.getShort(13)); // relation id
- }
+ cs.setLeftId(bb.getShort(9)); // left id
+ cs.setRightId(bb.getShort(11)); // right id
+ if (length > 13) {
+ cs.setSpanId(bb.getShort(13)); // relation id
+ }
}
else if (payloadTypeIdentifier == PayloadTypeIdentifier.ELEMENT_TO_TERM.value) { // length
// 15
@@ -217,31 +218,31 @@
i = bb.getInt(5);
cs.setRightStart(i);
cs.setRightEnd(i + 1);
- cs.setLeftId(bb.getShort(9)); // left id
- cs.setRightId(bb.getShort(11)); // right id
- if (length > 13) {
- cs.setSpanId(bb.getShort(13)); // relation id
- }
+ cs.setLeftId(bb.getShort(9)); // left id
+ cs.setRightId(bb.getShort(11)); // right id
+ if (length > 13) {
+ cs.setSpanId(bb.getShort(13)); // relation id
+ }
}
else if (payloadTypeIdentifier == PayloadTypeIdentifier.ELEMENT_TO_ELEMENT.value) {
- // length 19
+ // length 19
cs.setEnd(bb.getInt(1));
cs.setLeftEnd(cs.end);
cs.setRightStart(bb.getInt(5));
cs.setRightEnd(bb.getInt(9));
- cs.setLeftId(bb.getShort(13)); // left id
- cs.setRightId(bb.getShort(15)); // right id
- if (length > 17) {
- cs.setSpanId(bb.getShort(17)); // relation id
- }
- }
+ cs.setLeftId(bb.getShort(13)); // left id
+ cs.setRightId(bb.getShort(15)); // right id
+ if (length > 17) {
+ cs.setSpanId(bb.getShort(17)); // relation id
+ }
+ }
// Payload is cleared.
}
- private void setPayload(CandidateSpan cs) throws IOException {
+ private void setPayload (CandidateSpan cs) throws IOException {
ArrayList<byte[]> payload = new ArrayList<byte[]>();
if (relationTermSpan.isPayloadAvailable()) {
payload.addAll(relationTermSpan.getPayload());
@@ -285,13 +286,13 @@
boolean keep) {
ByteBuffer buffer = null;
if (keep) {
- buffer = ByteBuffer.allocate(10);
+ buffer = ByteBuffer.allocate(10);
}
else {
- buffer = ByteBuffer.allocate(11);
+ buffer = ByteBuffer.allocate(11);
}
- Byte classPTI = 0;
- buffer.put(classPTI);
+ Byte classPTI = 0;
+ buffer.put(classPTI);
buffer.putInt(start);
buffer.putInt(end);
buffer.put(classNumber);
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/SimpleSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/SimpleSpans.java
index 4a383ee..6918e38 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/SimpleSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/SimpleSpans.java
@@ -36,7 +36,8 @@
protected short spanId;
protected boolean hasSpanId = false;
- protected byte payloadTypeIdentifier;
+ protected byte payloadTypeIdentifier;
+
public SimpleSpans () {
collectPayloads = true;
@@ -127,10 +128,10 @@
}
- @Override
+ @Override
public int end () {
return matchEndPosition;
- }
+ }
@Override
@@ -177,22 +178,24 @@
this.spanId = spanId;
}
- /**
- * Gets the payload type identifier (PTI) of the current span
- *
- * @return a payload type identifier
- */
- public byte getPayloadTypeIdentifier() {
- return payloadTypeIdentifier;
- }
- /**
- * Sets the payload type identifier (PTI) of the current span
- *
- * @param payloadTypeIdentifier
- */
- public void setPayloadTypeIdentifier(byte payloadTypeIdentifier) {
- this.payloadTypeIdentifier = payloadTypeIdentifier;
- }
+ /**
+ * Gets the payload type identifier (PTI) of the current span
+ *
+ * @return a payload type identifier
+ */
+ public byte getPayloadTypeIdentifier () {
+ return payloadTypeIdentifier;
+ }
+
+
+ /**
+ * Sets the payload type identifier (PTI) of the current span
+ *
+ * @param payloadTypeIdentifier
+ */
+ public void setPayloadTypeIdentifier (byte payloadTypeIdentifier) {
+ this.payloadTypeIdentifier = payloadTypeIdentifier;
+ }
}
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithAttribute.java b/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithAttribute.java
index e58f59d..147f9ed 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithAttribute.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/SpansWithAttribute.java
@@ -238,12 +238,12 @@
*/
private boolean searchSpanPosition () throws IOException {
while (hasMoreSpans) {
- // the element does not have an attribute
- if (referentSpans.getSpanId() < 1) {
- if (attributeList.size() == 0 || notAttributeList.size() > 0) {
- return true;
- }
- hasMoreSpans = referentSpans.next();
+ // the element does not have an attribute
+ if (referentSpans.getSpanId() < 1) {
+ if (attributeList.size() == 0 || notAttributeList.size() > 0) {
+ return true;
+ }
+ hasMoreSpans = referentSpans.next();
continue;
}
if (checkAttributeListPosition()) {
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/SubSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/SubSpans.java
index 1bcfc40..64c2355 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/SubSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/SubSpans.java
@@ -35,9 +35,9 @@
* @param termContexts
* @throws IOException
*/
- public SubSpans (SpanSubspanQuery subspanQuery,
- LeafReaderContext context, Bits acceptDocs,
- Map<Term, TermContext> termContexts) throws IOException {
+ public SubSpans (SpanSubspanQuery subspanQuery, LeafReaderContext context,
+ Bits acceptDocs, Map<Term, TermContext> termContexts)
+ throws IOException {
super(subspanQuery, context, acceptDocs, termContexts);
this.startOffset = subspanQuery.getStartOffset();
this.length = subspanQuery.getLength();
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/TokenDistanceSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/TokenDistanceSpans.java
index e4b5d1b..a33e219 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/TokenDistanceSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/TokenDistanceSpans.java
@@ -125,15 +125,16 @@
@Override
public long cost () {
- if (candidateList.size() > 0) {
- long cost = 0;
- for (CandidateSpan candidateSpan : candidateList) {
- cost += candidateSpan.getCost();
- }
- return cost + secondSpans.cost();
- } else {
- return firstSpans.cost() + secondSpans.cost();
- }
+ if (candidateList.size() > 0) {
+ long cost = 0;
+ for (CandidateSpan candidateSpan : candidateList) {
+ cost += candidateSpan.getCost();
+ }
+ return cost + secondSpans.cost();
+ }
+ else {
+ return firstSpans.cost() + secondSpans.cost();
+ }
}
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/UnorderedDistanceSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/UnorderedDistanceSpans.java
index 705450d..3088b9f 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/UnorderedDistanceSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/UnorderedDistanceSpans.java
@@ -47,8 +47,7 @@
* @throws IOException
*/
public UnorderedDistanceSpans (SpanDistanceQuery query,
- LeafReaderContext context,
- Bits acceptDocs,
+ LeafReaderContext context, Bits acceptDocs,
Map<Term, TermContext> termContexts)
throws IOException {
super(query, context, acceptDocs, termContexts);
diff --git a/src/main/java/de/ids_mannheim/korap/response/Match.java b/src/main/java/de/ids_mannheim/korap/response/Match.java
index 2027ab5..0ed45b2 100644
--- a/src/main/java/de/ids_mannheim/korap/response/Match.java
+++ b/src/main/java/de/ids_mannheim/korap/response/Match.java
@@ -244,14 +244,13 @@
if (DEBUG)
log.trace(
"Have a highlight of class {} in {}-{} inside of {}-{}",
- number, start, end,
- this.getStartPos(),
+ number, start, end, this.getStartPos(),
this.getEndPos());
// Ignore classes out of match range and set by the system
// TODO: This may be decidable by PTI!
if ((number & 0xFF) <= 128 && start >= this.getStartPos()
- && end <= this.getEndPos()) {
+ && end <= this.getEndPos()) {
log.trace("Add highlight of class {}!", number);
this.addHighlight(start, end - 1, number);
}
@@ -797,7 +796,8 @@
int newStartChar = -1, newEndChar = -1;
if (DEBUG)
- log.trace("Extend match to context boundary with {} in docID {}",
+ log.trace(
+ "Extend match to context boundary with {} in docID {}",
cquery.toString(), this.localDocID);
while (true) {
@@ -843,7 +843,8 @@
};
}
catch (Exception e) {
- log.warn("Some problems with ByteBuffer: " + e.getMessage());
+ log.warn("Some problems with ByteBuffer: "
+ + e.getMessage());
};
};
}
@@ -917,7 +918,7 @@
// Relevant details are missing
if (this.positionsToOffset == null || this.localDocID == -1) {
log.warn("You have to define "
- + "positionsToOffset and localDocID first before");
+ + "positionsToOffset and localDocID first before");
return false;
};
diff --git a/src/main/java/de/ids_mannheim/korap/response/Response.java b/src/main/java/de/ids_mannheim/korap/response/Response.java
index 2dc6516..4ac95f9 100644
--- a/src/main/java/de/ids_mannheim/korap/response/Response.java
+++ b/src/main/java/de/ids_mannheim/korap/response/Response.java
@@ -51,8 +51,7 @@
private HashMap<String, ObjectNode> jsonFields;
- private static final String KORAL_VERSION =
- "http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld";
+ private static final String KORAL_VERSION = "http://korap.ids-mannheim.de/ns/KoralQuery/v0.3/context.jsonld";
/**
@@ -444,6 +443,7 @@
return (Response) this.moveNotificationsFrom(meta);
};
+
public void addJsonNode (String key, ObjectNode value) {
if (this.jsonFields == null)
this.jsonFields = new HashMap<String, ObjectNode>(4);
diff --git a/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java b/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java
index 6d7de11..e29c2b4 100644
--- a/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java
+++ b/src/test/java/de/ids_mannheim/korap/benchmark/TestBenchmarkSpans.java
@@ -34,8 +34,8 @@
prop.load(fr);
// Get the real index
- KrillIndex ki = new KrillIndex(new MMapDirectory(Paths.get(
- prop.getProperty("krill.indexDir"))));
+ KrillIndex ki = new KrillIndex(new MMapDirectory(Paths.get(prop
+ .getProperty("krill.indexDir"))));
// Create a container for virtual collections:
KrillCollection kc = new KrillCollection(ki);
@@ -88,8 +88,8 @@
prop.load(fr);
// Get the real index
- KrillIndex ki = new KrillIndex(new MMapDirectory(Paths.get(
- prop.getProperty("krill.indexDir"))));
+ KrillIndex ki = new KrillIndex(new MMapDirectory(Paths.get(prop
+ .getProperty("krill.indexDir"))));
// Create a container for virtual collections:
KrillCollection kc = new KrillCollection(ki);
@@ -134,8 +134,8 @@
prop.load(fr);
// Get the real index
- KrillIndex ki = new KrillIndex(new MMapDirectory(Paths.get(
- prop.getProperty("krill.indexDir"))));
+ KrillIndex ki = new KrillIndex(new MMapDirectory(Paths.get(prop
+ .getProperty("krill.indexDir"))));
// Create a container for virtual collections:
KrillCollection kc = new KrillCollection(ki);
@@ -180,8 +180,8 @@
prop.load(fr);
// Get the real index
- KrillIndex ki = new KrillIndex(new MMapDirectory(Paths.get(
- prop.getProperty("krill.indexDir"))));
+ KrillIndex ki = new KrillIndex(new MMapDirectory(Paths.get(prop
+ .getProperty("krill.indexDir"))));
// Create a container for virtual collections:
KrillCollection kc = new KrillCollection(ki);
@@ -326,8 +326,8 @@
prop.load(fr);
// Get the real index
- KrillIndex ki = new KrillIndex(new MMapDirectory(Paths.get(
- prop.getProperty("krill.indexDir"))));
+ KrillIndex ki = new KrillIndex(new MMapDirectory(Paths.get(prop
+ .getProperty("krill.indexDir"))));
// Create a container for virtual collections:
KrillCollection kc = new KrillCollection(ki);
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestAttributeIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestAttributeIndex.java
index 085c42a..8d7027f 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestAttributeIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestAttributeIndex.java
@@ -36,35 +36,35 @@
fd.addTV(
"base",
"bcbabd",
- "[(0-1)s:a|_1$<i>0<i>1|"
- + "<>:s$<b>64<i>0<i>5<i>5<b>0<s>3|"
+ "[(0-1)s:a|_1$<i>0<i>1|"
+ + "<>:s$<b>64<i>0<i>5<i>5<b>0<s>3|"
+ "<>:div$<b>64<i>0<i>2<i>2<b>0<s>2|"
+ "<>:div$<b>64<i>0<i>3<i>3<b>0<s>1|"
+ "@:class=header$<b>17<i>3<s>1|@:class=header$<b>17<i>2<s>2]"
+ "[(1-2)s:e|_2$<i>1<i>2|"
+ "<>:a$<b>64<i>1<i>2<i>2<b>0<s>1|@:class=header$<b>17<i>2<s>1]"
-
- + "[(2-3)s:e|_3$<i>2<i>3|"
+
+ + "[(2-3)s:e|_3$<i>2<i>3|"
+ "<>:div$<b>64<i>2<i>5<i>5<b>0<s>1|@:class=time$<b>17<i>5<s>1]"
-
- + "[(3-4)s:a|_4$<i>3<i>4|"
+
+ + "[(3-4)s:a|_4$<i>3<i>4|"
+ "<>:div$<b>64<i>3<i>5<i>5<b>0<s>1|@:class=header$<b>17<i>5<s>1]"
-
- + "[(4-5)s:b|_5$<i>4<i>5|"
- + "<>:a$<b>64<i>4<i>5<i>5<b>0<s>2|"
+
+ + "[(4-5)s:b|_5$<i>4<i>5|"
+ + "<>:a$<b>64<i>4<i>5<i>5<b>0<s>2|"
+ "<>:div$<b>64<i>4<i>5<i>5<b>0<s>1|"
- + "@:class=header$<b>17<i>5<s>2]"
-
- + "[(5-6)s:d|_6$<i>5<i>6|"
- + "<>:div$<b>64<i>5<i>6<i>6<b>0<s>2|"
+ + "@:class=header$<b>17<i>5<s>2]"
+
+ + "[(5-6)s:d|_6$<i>5<i>6|"
+ + "<>:div$<b>64<i>5<i>6<i>6<b>0<s>2|"
+ "<>:s$<b>64<i>5<i>6<i>6<b>0<s>1|"
- + "@:class=header$<b>17<i>6<s>1]"
-
- + "[(6-7)s:d|_7$<i>6<i>7|"
- + "<>:s$<b>64<i>6<i>7<i>7<b>0<s>2|"
+ + "@:class=header$<b>17<i>6<s>1]"
+
+ + "[(6-7)s:d|_7$<i>6<i>7|"
+ + "<>:s$<b>64<i>6<i>7<i>7<b>0<s>2|"
+ "<>:div$<b>64<i>6<i>7<i>7<b>0<s>1"
- + "|@:class=header$<b>17<i>7<s>1|@:class=header$<b>17<i>7<s>2]");
+ + "|@:class=header$<b>17<i>7<s>1|@:class=header$<b>17<i>7<s>2]");
return fd;
}
@@ -76,33 +76,33 @@
fd.addTV(
"base",
"bcbabd",
- "[(0-1)s:b|_1$<i>0<i>1|"
- + "<>:s<b>64<i>0<i>5<i>5<b>0<s>2|"
+ "[(0-1)s:b|_1$<i>0<i>1|"
+ + "<>:s<b>64<i>0<i>5<i>5<b>0<s>2|"
+ "<>:div$<b>64<i>0<i>3<i>3<b>0<s>1|"
- + "@:class=header$<b>17<i>3<s>1|@:class=title$<b>17<i>3<s>1|@:class=book$<b>17<i>3<s>1]"
+ + "@:class=header$<b>17<i>3<s>1|@:class=title$<b>17<i>3<s>1|@:class=book$<b>17<i>3<s>1]"
- + "[(1-2)s:c|_2$<i>1<i>2|"
+ + "[(1-2)s:c|_2$<i>1<i>2|"
+ "<>:div$<b>64<i>1<i>2<i>2<b>0<s>1|"
- + "@:class=header$<b>17<i>2<s>1|@:class=title$<b>17<i>2<s>1]"
+ + "@:class=header$<b>17<i>2<s>1|@:class=title$<b>17<i>2<s>1]"
- + "[(2-3)s:b|_3$<i>2<i>3|"
+ + "[(2-3)s:b|_3$<i>2<i>3|"
+ "<>:div$<b>64<i>2<i>5<i>5<b>0<s>1|@:class=book$<b>17<i>5<s>1]"
- + "[(3-4)s:a|_4$<i>3<i>4|"
+ + "[(3-4)s:a|_4$<i>3<i>4|"
+ "<>:div$<b>64<i>3<i>5<i>5<b>0<s>1|@:class=title$<b>17<i>5<s>1]"
- + "[(4-5)s:b|_5$<i>4<i>5|"
+ + "[(4-5)s:b|_5$<i>4<i>5|"
+ "<>:div$<b>64<i>4<i>5<i>5<b>0<s>1|"
- + "@:class=header$<b>17<i>5<s>1|@:class=book$<b>17<i>5<s>1|@:class=title$<b>17<i>5<s>1]"
+ + "@:class=header$<b>17<i>5<s>1|@:class=book$<b>17<i>5<s>1|@:class=title$<b>17<i>5<s>1]"
- + "[(5-6)s:d|_6$<i>5<i>6|"
- + "<>:s$<b>64<i>5<i>6<i>6<b>0<s>2|"
+ + "[(5-6)s:d|_6$<i>5<i>6|"
+ + "<>:s$<b>64<i>5<i>6<i>6<b>0<s>2|"
+ "<>:div$<b>64<i>5<i>6<i>6<b>0<s>1|@:class=header$<b>17<i>6<s>1]"
- + "[(6-7)s:d|_7$<i>6<i>7|"
- + "<>:s$<b>64<i>6<i>7<i>7<b>0<s>2|"
+ + "[(6-7)s:d|_7$<i>6<i>7|"
+ + "<>:s$<b>64<i>6<i>7<i>7<b>0<s>2|"
+ "<>:div$<b>64<i>6<i>7<i>7<b>0<s>1|"
- + "@:class=header$<b>17<i>7<s>1|@:class=title$<b>17<i>7<s>1]");
+ + "@:class=header$<b>17<i>7<s>1|@:class=title$<b>17<i>7<s>1]");
return fd;
}
@@ -114,35 +114,35 @@
fd.addTV(
"base",
"bcbabd",
- "[(0-1)s:b|_1$<i>0<i>1|"
- + "<>:div$<b>64<i>0<i>3<i>3<b>0<s>2|"
+ "[(0-1)s:b|_1$<i>0<i>1|"
+ + "<>:div$<b>64<i>0<i>3<i>3<b>0<s>2|"
+ "<>:s$<b>64<i>0<i>5<i>5<b>0<s>1|"
- + "@:class=header$<b>17<i>3<s>2|@:class=book$<b>17<i>5<s>1|@:class=book$<b>17<i>3<s>2]"
+ + "@:class=header$<b>17<i>3<s>2|@:class=book$<b>17<i>5<s>1|@:class=book$<b>17<i>3<s>2]"
- + "[(1-2)s:e|_2$<i>1<i>2|"
- + "<>:a$<b>64<i>1<i>2<i>2<b>0<s>2|"
+ + "[(1-2)s:e|_2$<i>1<i>2|"
+ + "<>:a$<b>64<i>1<i>2<i>2<b>0<s>2|"
+ "<>:div$<b>64<i>1<i>2<i>2<b>0<s>1|"
- + "@:class=book$<b>17<i>2<s>2|@:class=header$<b>17<i>2<s>1]"
+ + "@:class=book$<b>17<i>2<s>2|@:class=header$<b>17<i>2<s>1]"
- + "[(2-3)s:b|_3$<i>2<i>3|"
- + "<>:a$<b>64<i>1<i>2<i>2<b>0<s>2|"
+ + "[(2-3)s:b|_3$<i>2<i>3|"
+ + "<>:a$<b>64<i>1<i>2<i>2<b>0<s>2|"
+ "<>:div$<b>64<i>2<i>3<i>5<b>0<s>1|"
- + "@:class=header$<b>17<i>2<s>2|@:class=book$<b>17<i>5<s>1]"
+ + "@:class=header$<b>17<i>2<s>2|@:class=book$<b>17<i>5<s>1]"
- + "[(3-4)s:a|_4$<i>3<i>4|"
+ + "[(3-4)s:a|_4$<i>3<i>4|"
+ "<>:div$<b>64<i>3<i>5<i>5<b>0<s>1|@:class=title$<b>17<i>5<s>1]"
- + "[(4-5)s:b|_5$<i>4<i>5|"
+ + "[(4-5)s:b|_5$<i>4<i>5|"
+ "<>:div$<b>64<i>4<i>5<i>5<b>0<s>1|@:class=header$<b>17<i>5<s>1|@:class=book$<b>17<i>5<s>1]"
- + "[(5-6)s:d|_6$<i>5<i>6|"
+ + "[(5-6)s:d|_6$<i>5<i>6|"
+ "<>:s$<b>64<i>5<i>6<i>6<b>0<s>1|"
+ "<>:div$<b>64<i>5<i>6<i>6<b>0<s>1|@:class=header$<b>17<i>6<s>1]"
- + "[(6-7)s:d|_7$<i>6<i>7|"
- + "<>:s$<b>64<i>6<i>7<i>7<b>0<s>2|"
+ + "[(6-7)s:d|_7$<i>6<i>7|"
+ + "<>:s$<b>64<i>6<i>7<i>7<b>0<s>2|"
+ "<>:div$<b>64<i>6<i>7<i>7<b>0<s>1|"
- + "@:class=header$<b>17<i>7<s>1|@:class=book$<b>17<i>7<s>2]");
+ + "@:class=header$<b>17<i>7<s>1|@:class=book$<b>17<i>7<s>2]");
return fd;
}
@@ -161,27 +161,27 @@
SpanAttributeQuery saq = new SpanAttributeQuery(new SpanTermQuery(
new Term("base", "@:class=header")), true);
- SpanElementQuery seq = new SpanElementQuery("base", "div");
+ SpanElementQuery seq = new SpanElementQuery("base", "div");
- // div with @class=header
- SpanQuery sq = new SpanWithAttributeQuery(seq, saq, true);
+ // div with @class=header
+ SpanQuery sq = new SpanWithAttributeQuery(seq, saq, true);
kr = ki.search(sq, (short) 10);
- // for (int i = 0; i < kr.getTotalResults(); i++) {
- // System.out.println(kr.getMatch(i).getLocalDocID() + " "
- // + kr.getMatch(i).startPos + " " + kr.getMatch(i).endPos);
- // }
- //
- assertEquals((long) 4, kr.getTotalResults());
- assertEquals(0, kr.getMatch(0).getStartPos());
- assertEquals(2, kr.getMatch(0).getEndPos());
- assertEquals(0, kr.getMatch(1).getStartPos());
- assertEquals(3, kr.getMatch(1).getEndPos());
- assertEquals(3, kr.getMatch(2).getStartPos());
- assertEquals(5, kr.getMatch(2).getEndPos());
- assertEquals(6, kr.getMatch(3).getStartPos());
- assertEquals(7, kr.getMatch(3).getEndPos());
+ // for (int i = 0; i < kr.getTotalResults(); i++) {
+ // System.out.println(kr.getMatch(i).getLocalDocID() + " "
+ // + kr.getMatch(i).startPos + " " + kr.getMatch(i).endPos);
+ // }
+ //
+ assertEquals((long) 4, kr.getTotalResults());
+ assertEquals(0, kr.getMatch(0).getStartPos());
+ assertEquals(2, kr.getMatch(0).getEndPos());
+ assertEquals(0, kr.getMatch(1).getStartPos());
+ assertEquals(3, kr.getMatch(1).getEndPos());
+ assertEquals(3, kr.getMatch(2).getStartPos());
+ assertEquals(5, kr.getMatch(2).getEndPos());
+ assertEquals(6, kr.getMatch(3).getStartPos());
+ assertEquals(7, kr.getMatch(3).getEndPos());
}
@@ -343,7 +343,7 @@
// + kr.getMatch(i).startPos + " " + kr.getMatch(i).endPos);
// }
- assertEquals((long) 6, kr.getTotalResults());
+ assertEquals((long) 6, kr.getTotalResults());
SpanNextQuery snq = new SpanNextQuery(new SpanTermQuery(new Term(
"base", "s:e")), sq);
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
index 86056c0..d722038 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
@@ -50,7 +50,9 @@
private FieldDocument createFieldDoc1 () {
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-1");
- fd.addTV("base", "text",
+ fd.addTV(
+ "base",
+ "text",
"[(0-1)s:e|_1$<i>0<i>1|<>:s$<b>64<i>0<i>2<i>1<b>0]"
+ "[(1-2)s:c|s:b|_2$<i>1<i>2|<>:s$<b>64<i>1<i>2<i>2<b>0]"
+ "[(2-3)s:e|_3$<i>2<i>3|<>:s$<b>64<i>2<i>3<i>3<b>0]"
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestElementIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestElementIndex.java
index 96a1d70..48850e5 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestElementIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestElementIndex.java
@@ -29,10 +29,9 @@
"[(0-3)s:x|<>:a$<b>64<i>0<i>3<i>12<b>0]"
+ "[(3-6)s:y|<>:a$<b>64<i>3<i>6<i>9<b>0]"
+ "[(6-9)s:z|<>:a$<b>64<i>6<i>9<i>6]"
- + "[(9-12)s:h<b>0]"
- + "[(12-15)s:i]" + "[(15-18)s:j]" + "[(18-21)s:h]"
- + "[(21-24)s:i]" + "[(24-27)s:j]" + "[(27-30)s:h]"
- + "[(30-33)s:i]" + "[(33-36)s:j]");
+ + "[(9-12)s:h<b>0]" + "[(12-15)s:i]" + "[(15-18)s:j]"
+ + "[(18-21)s:h]" + "[(21-24)s:i]" + "[(24-27)s:j]"
+ + "[(27-30)s:h]" + "[(30-33)s:i]" + "[(33-36)s:j]");
ki.addDoc(fd);
// <a>x<a>y<a>zcde</a>cde</a>cde</a>cde</a>
@@ -41,10 +40,9 @@
"[(0-3)s:x|<>:a$<b>64<i>0<i>3<i>12<b>0]"
+ "[(3-6)s:y|<>:a$<b>64<i>3<i>6<i>9<b>0]"
+ "[(6-9)s:z|<>:a$<b>64<i>6<i>9<i>6]"
- + "[(9-12)s:c<b>0]"
- + "[(12-15)s:d]" + "[(15-18)s:e]" + "[(18-21)s:c]"
- + "[(21-24)s:d]" + "[(24-27)s:e]" + "[(27-30)s:c]"
- + "[(30-33)s:d]" + "[(33-36)s:e]");
+ + "[(9-12)s:c<b>0]" + "[(12-15)s:d]" + "[(15-18)s:e]"
+ + "[(18-21)s:c]" + "[(21-24)s:d]" + "[(24-27)s:e]"
+ + "[(27-30)s:c]" + "[(30-33)s:d]" + "[(33-36)s:e]");
ki.addDoc(fd);
// Save documents
@@ -82,14 +80,12 @@
// <a><a><a>h</a>hhij</a>hij</a>hij</a>
FieldDocument fd = new FieldDocument();
- fd.addTV("base", "h h i j h i j h i j ",
- "[(0-3)s:h|"
+ fd.addTV("base", "h h i j h i j h i j ", "[(0-3)s:h|"
+ "<>:a$<b>64<i>0<i>18<i>3<b>0|"
+ "<>:a$<b>64<i>0<i>27<i>6<b>0|" + "<>:a$<b>64<i>0<i>36<i>9]"
- + "[(3-6)s:h]" + "[(12-15)s:i<b>0]"
- + "[(15-18)s:j]" + "[(18-21)s:h]" + "[(21-24)s:i]"
- + "[(24-27)s:j]" + "[(27-30)s:h]" + "[(30-33)s:i]"
- + "[(33-36)s:j]");
+ + "[(3-6)s:h]" + "[(12-15)s:i<b>0]" + "[(15-18)s:j]"
+ + "[(18-21)s:h]" + "[(21-24)s:i]" + "[(24-27)s:j]"
+ + "[(27-30)s:h]" + "[(30-33)s:i]" + "[(33-36)s:j]");
ki.addDoc(fd);
// Save documents
@@ -117,8 +113,7 @@
// <a><a><a>u</a></a></a>
FieldDocument fd = new FieldDocument();
- fd.addTV("base", "xyz",
- "[(0-3)s:xyz|<>:a$<b>64<i>0<i>3<i>0<b>0|"
+ fd.addTV("base", "xyz", "[(0-3)s:xyz|<>:a$<b>64<i>0<i>3<i>0<b>0|"
+ "<>:a$<b>64<i>0<i>3<i>0<b>0|"
+ "<>:a$<b>64<i>0<i>3<i>0<b>0|<>:b$<b>64<i>0<i>3<i>0<b>0]");
ki.addDoc(fd);
@@ -129,10 +124,9 @@
"[(0-3)s:x|<>:a$<b>64<i>0<i>36<i>12<b>0|<>:b$<b>64<i>0<i>36<i>12<b>0]"
+ "[(3-6)s:y|<>:a$<b>64<i>3<i>27<i>9<b>0]"
+ "[(6-9)s:z|<>:a$<b>64<i>6<i>18<i>6]"
- + "[(9-12)s:c<b>0]"
- + "[(12-15)s:d]" + "[(15-18)s:e]" + "[(18-21)s:c]"
- + "[(21-24)s:d]" + "[(24-27)s:e]" + "[(27-30)s:c]"
- + "[(30-33)s:d]" + "[(33-36)s:e]");
+ + "[(9-12)s:c<b>0]" + "[(12-15)s:d]" + "[(15-18)s:e]"
+ + "[(18-21)s:c]" + "[(21-24)s:d]" + "[(24-27)s:e]"
+ + "[(27-30)s:c]" + "[(30-33)s:d]" + "[(33-36)s:e]");
ki.addDoc(fd);
// xyz
@@ -143,26 +137,26 @@
// <a>x<a><b>y<a>zcde</a>cde</b></a>cde</a>
fd = new FieldDocument();
- fd.addTV("base", "x y z k l m k l m k l m ",
+ fd.addTV(
+ "base",
+ "x y z k l m k l m k l m ",
"[(0-3)s:x|<>:a$<b>64<i>0<i>3<i>12<b>0]"
+ "[(3-6)s:y|<>:a$<b>64<i>3<i>6<i>9<b>0|<>:b$<b>64<i>3<i>6<i>9<b>0]"
+ "[(6-9)s:z|<>:a$<b>64<i>6<i>9<i>6<b>0]"
- + "[(9-12)s:k<b>0]"
- + "[(12-15)s:l]" + "[(15-18)s:m]" + "[(18-21)s:k]"
- + "[(21-24)s:l]" + "[(24-27)s:m]" + "[(27-30)s:k]"
- + "[(30-33)s:l]" + "[(33-36)s:m]");
+ + "[(9-12)s:k<b>0]" + "[(12-15)s:l]" + "[(15-18)s:m]"
+ + "[(18-21)s:k]" + "[(21-24)s:l]" + "[(24-27)s:m]"
+ + "[(27-30)s:k]" + "[(30-33)s:l]" + "[(33-36)s:m]");
ki.addDoc(fd);
// <a><a><a>h</a>hhij</a>hij</a>hij</a>
fd = new FieldDocument();
- fd.addTV("base", "h h i j h i j h i j ",
- "[(0-3)s:h|"
+ fd.addTV("base", "h h i j h i j h i j ", "[(0-3)s:h|"
+ "<>:a$<b>64<i>0<i>18<i>3<b>0|"
+ "<>:a$<b>64<i>0<i>27<i>6<b>0|"
- + "<>:a$<b>64<i>0<i>36<i>9<b>0]"
- + "[(3-6)s:h]" + "[(12-15)s:i]" + "[(15-18)s:j]"
- + "[(18-21)s:h]" + "[(21-24)s:i]" + "[(24-27)s:j]"
- + "[(27-30)s:h]" + "[(30-33)s:i]" + "[(33-36)s:j]");
+ + "<>:a$<b>64<i>0<i>36<i>9<b>0]" + "[(3-6)s:h]"
+ + "[(12-15)s:i]" + "[(15-18)s:j]" + "[(18-21)s:h]"
+ + "[(21-24)s:i]" + "[(24-27)s:j]" + "[(27-30)s:h]"
+ + "[(30-33)s:i]" + "[(33-36)s:j]");
ki.addDoc(fd);
// xyz
@@ -220,8 +214,11 @@
KrillIndex ki = new KrillIndex();
FieldDocument fd = new FieldDocument();
- fd.addTV("base", "111111ccc222222fff333333iiijjj",
- "[(0-3)s:a|_0$<i>0<i>3]" + "[(3-6)s:b|_1$<i>3<i>6]"
+ fd.addTV(
+ "base",
+ "111111ccc222222fff333333iiijjj",
+ "[(0-3)s:a|_0$<i>0<i>3]"
+ + "[(3-6)s:b|_1$<i>3<i>6]"
+ "[(6-9)s:c|_2$<i>6<i>9]"
+ "[(9-12)s:d|_3$<i>9<i>12|<>:a$<b>64<i>9<i>15<i>4<b>0]"
+ "[(12-15)s:e|_4$<i>12<i>15]"
@@ -254,9 +251,12 @@
KrillIndex ki = new KrillIndex();
FieldDocument fd = new FieldDocument();
- fd.addTV("base", "111111ccc222222fff333333iiijjj",
+ fd.addTV(
+ "base",
+ "111111ccc222222fff333333iiijjj",
"[(0-3)s:a|_0$<i>0<i>3|<>:a$<b>64<i>0<i>6<i>1<b>0]"
- + "[(3-6)s:b|_1$<i>3<i>6]" + "[(6-9)s:c|_2$<i>6<i>9]"
+ + "[(3-6)s:b|_1$<i>3<i>6]"
+ + "[(6-9)s:c|_2$<i>6<i>9]"
+ "[(9-12)s:d|_3$<i>9<i>12|<>:a$<b>64<i>9<i>15<i>4<b>0]"
+ "[(12-15)s:e|_4$<i>12<i>15]"
+ "[(15-18)s:f|_5$<i>15<i>18]"
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java b/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
index 74baae6..5ce430f 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestFieldDocument.java
@@ -83,21 +83,27 @@
@Test
public void indexExample2 () throws Exception {
- String json = new String("{" + " \"fields\" : [" + " { "
- + " \"primaryData\" : \"abc\"" + " }," + " {"
- + " \"name\" : \"tokens\"," + " \"data\" : ["
+ String json = new String(
+ "{"
+ + " \"fields\" : ["
+ + " { "
+ + " \"primaryData\" : \"abc\""
+ + " },"
+ + " {"
+ + " \"name\" : \"tokens\","
+ + " \"data\" : ["
+ " [ \"s:a\", \"i:a\", \"_0$<i>0<i>1\", \"-:t$<i>3\"],"
+ " [ \"s:b\", \"i:b\", \"_1$<i>1<i>2\" ],"
+ " [ \"s:c\", \"i:c\", \"_2$<i>2<i>3\" ]"
- + " ]"
- + " }" + " ]," + " \"corpusID\" : \"WPD\","
- + " \"ID\" : \"WPD-AAA-00001\","
- + " \"textClass\" : \"music entertainment\","
- + " \"author\" : \"Peter Frankenfeld\","
- + " \"pubDate\" : 20130617,"
- + " \"title\" : \"Wikipedia\","
- + " \"subTitle\" : \"Die freie Enzyklopädie\","
- + " \"pubPlace\" : \"Bochum\"" + "}");
+ + " ]" + " }" + " ],"
+ + " \"corpusID\" : \"WPD\","
+ + " \"ID\" : \"WPD-AAA-00001\","
+ + " \"textClass\" : \"music entertainment\","
+ + " \"author\" : \"Peter Frankenfeld\","
+ + " \"pubDate\" : 20130617,"
+ + " \"title\" : \"Wikipedia\","
+ + " \"subTitle\" : \"Die freie Enzyklopädie\","
+ + " \"pubPlace\" : \"Bochum\"" + "}");
KrillIndex ki = new KrillIndex();
FieldDocument fd = ki.addDoc(json);
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestMultipleDistanceIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestMultipleDistanceIndex.java
index e291485..7054aa4 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestMultipleDistanceIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestMultipleDistanceIndex.java
@@ -53,7 +53,9 @@
private FieldDocument createFieldDoc0 () {
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-0");
- fd.addTV("base", "text",
+ fd.addTV(
+ "base",
+ "text",
"[(0-1)s:b|_1$<i>0<i>1|<>:s$<b>64<i>0<i>2<i>2<b>0|<>:p$<b>64<i>0<i>4<i>4<b>0]"
+ "[(1-2)s:b|s:c|_2$<i>1<i>2]"
+ "[(2-3)s:c|_3$<i>2<i>3|<>:s$<b>64<i>2<i>3<i>4<b>0]"
@@ -67,7 +69,9 @@
private FieldDocument createFieldDoc1 () {
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-1");
- fd.addTV("base", "text",
+ fd.addTV(
+ "base",
+ "text",
"[(0-1)s:c|_1$<i>0<i>1|<>:s$<b>64<i>0<i>2<i>2<b>0|<>:p$<b>64<i>0<i>4<i>4<b>0]"
+ "[(1-2)s:c|s:e|_2$<i>1<i>2]"
+ "[(2-3)s:e|_3$<i>2<i>3|<>:s$<b>64<i>2<i>3<i>4<b>0]"
@@ -81,7 +85,9 @@
private FieldDocument createFieldDoc2 () {
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-2");
- fd.addTV("base", "text",
+ fd.addTV(
+ "base",
+ "text",
"[(0-1)s:b|_1$<i>0<i>1|<>:s$<b>64<i>0<i>2<i>2<b>0|<>:p$<b>64<i>0<i>4<i>4<b>0]"
+ "[(1-2)s:b|s:e|_2$<i>1<i>2]"
+ "[(2-3)s:e|_3$<i>2<i>3|<>:s$<b>64<i>2<i>3<i>4<b>0]"
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestNextIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestNextIndex.java
index d80acf2..23674b6 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestNextIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestNextIndex.java
@@ -93,12 +93,19 @@
// abcabcabac
FieldDocument fd = new FieldDocument();
- fd.addTV("base", "abcabcabac", "[(0-1)s:a|i:a|_0$<i>0<i>1|-:t$<i>10]"
- + "[(1-2)s:b|i:b|_1$<i>1<i>2]" + "[(2-3)s:c|i:c|_2$<i>2<i>3]"
+ fd.addTV(
+ "base",
+ "abcabcabac",
+ "[(0-1)s:a|i:a|_0$<i>0<i>1|-:t$<i>10]"
+ + "[(1-2)s:b|i:b|_1$<i>1<i>2]"
+ + "[(2-3)s:c|i:c|_2$<i>2<i>3]"
+ "[(3-4)s:a|i:a|_3$<i>3<i>4|<>:x$<b>64<i>3<i>4<i>4<b>0|<>:x$<b>64<i>3<i>7<i>7<b>0]"
- + "[(4-5)s:b|i:b|_4$<i>4<i>5]" + "[(5-6)s:c|i:c|_5$<i>5<i>6]"
- + "[(6-7)s:a|i:a|_6$<i>6<i>7]" + "[(7-8)s:b|i:b|_7$<i>7<i>8]"
- + "[(8-9)s:a|i:a|_8$<i>8<i>9]" + "[(9-10)s:c|i:c|_9$<i>9<i>10]");
+ + "[(4-5)s:b|i:b|_4$<i>4<i>5]"
+ + "[(5-6)s:c|i:c|_5$<i>5<i>6]"
+ + "[(6-7)s:a|i:a|_6$<i>6<i>7]"
+ + "[(7-8)s:b|i:b|_7$<i>7<i>8]"
+ + "[(8-9)s:a|i:a|_8$<i>8<i>9]"
+ + "[(9-10)s:c|i:c|_9$<i>9<i>10]");
ki.addDoc(fd);
ki.commit();
@@ -323,9 +330,11 @@
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-0");
fd.addTV("base", "bcbadb", "[(0-1)s:b|i:b|_0$<i>0<i>1]"
- + "[(1-2)s:c|i:c|s:b|_1$<i>1<i>2]" + "[(2-3)s:b|i:b|_2$<i>2<i>3]"
+ + "[(1-2)s:c|i:c|s:b|_1$<i>1<i>2]"
+ + "[(2-3)s:b|i:b|_2$<i>2<i>3]"
+ "[(3-4)s:a|i:a|_3$<i>3<i>4|<>:e$<b>64<i>3<i>6<i>6<b>0]"
- + "[(4-5)s:d|i:d|s:c|_4$<i>4<i>5]" + "[(5-6)s:b|i:b|_5$<i>5<i>6]");
+ + "[(4-5)s:d|i:d|s:c|_4$<i>4<i>5]"
+ + "[(5-6)s:b|i:b|_5$<i>5<i>6]");
return fd;
}
@@ -335,7 +344,8 @@
fd.addString("ID", "doc-1");
fd.addTV("base", "caba", "[(0-1)s:c|i:c|_0$<i>0<i>1]"
+ "[(1-2)s:a|i:a|s:c|_1$<i>1<i>2|<>:e$<b>64<i>1<i>3<i>3<b>0]"
- + "[(2-3)s:b|i:b|s:a|_2$<i>2<i>3]" + "[(3-4)s:a|i:a|_3$<i>3<i>4]");
+ + "[(2-3)s:b|i:b|s:a|_2$<i>2<i>3]"
+ + "[(3-4)s:a|i:a|_3$<i>3<i>4]");
return fd;
}
@@ -344,7 +354,8 @@
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-2");
fd.addTV("base", "cdbd", "[(0-1)s:c|i:c|_0$<i>0<i>1]"
- + "[(1-2)s:d|i:d|_1$<i>1<i>2]" + "[(2-3)s:b|i:b|s:a|_2$<i>2<i>3]"
+ + "[(1-2)s:d|i:d|_1$<i>1<i>2]"
+ + "[(2-3)s:b|i:b|s:a|_2$<i>2<i>3]"
+ "[(3-4)s:d|i:d|_3$<i>3<i>4]");
return fd;
@@ -354,11 +365,15 @@
private FieldDocument createFieldDoc4 () {
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-3");
- fd.addTV("base", "bcbadb", "[(0-1)s:b|i:b|_0$<i>0<i>1]"
- + "[(1-2)s:c|i:c|s:b|<>:s$<b>64<i>1<i>3<i>3<b>0|_1$<i>1<i>2<b>0]"
- + "[(2-3)s:b|i:b|_2$<i>2<i>3]"
- + "[(3-4)s:a|i:a|_3$<i>3<i>4|<>:e$<b>64<i>3<i>6<i>6<b>0]"
- + "[(4-5)s:d|i:d|s:c|_4$<i>4<i>5]" + "[(5-6)s:b|i:b|_5$<i>5<i>6]");
+ fd.addTV(
+ "base",
+ "bcbadb",
+ "[(0-1)s:b|i:b|_0$<i>0<i>1]"
+ + "[(1-2)s:c|i:c|s:b|<>:s$<b>64<i>1<i>3<i>3<b>0|_1$<i>1<i>2<b>0]"
+ + "[(2-3)s:b|i:b|_2$<i>2<i>3]"
+ + "[(3-4)s:a|i:a|_3$<i>3<i>4|<>:e$<b>64<i>3<i>6<i>6<b>0]"
+ + "[(4-5)s:d|i:d|s:c|_4$<i>4<i>5]"
+ + "[(5-6)s:b|i:b|_5$<i>5<i>6]");
return fd;
}
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestReferenceIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestReferenceIndex.java
index 8bc0242..9decc2b 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestReferenceIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestReferenceIndex.java
@@ -71,14 +71,14 @@
SpanReferenceQuery ref = new SpanReferenceQuery(sdq, (byte) 3, true);
// System.out.println(ref.toString());
- kr = ki.search(ref, (short) 10);
+ kr = ki.search(ref, (short) 10);
/*
- for (Match km : kr.getMatches()) {
+ for (Match km : kr.getMatches()) {
- System.out.println(km.getStartPos() + "," + km.getEndPos() + " "
- + km.getSnippetBrackets());
- }
- System.out.println(kr.getTotalResults());
+ System.out.println(km.getStartPos() + "," + km.getEndPos() + " "
+ + km.getSnippetBrackets());
+ }
+ System.out.println(kr.getTotalResults());
*/
assertEquals(
"spanReference(spanDistance(focus(1: focus(#[1,2]spanSegment("
@@ -246,30 +246,30 @@
"tokens",
"Frankenstein, treat my daughter well. She is the one that saved your master who you hold so dear.",
- "[(0-12)s:Frankenstein|_0$<i>0<i>12|"
- + "<>:nn$<b>64<i>0<i>12<i>1<b>0<s>3|"
- + "<>:np$<b>64<i>0<i>13<i>1<b>0<s>2|"
- + "<>:s$<b>64<i>0<i>37<i>4<b>0<s>1|"
- + "<:stanford/d:tag$<b>32<i>1<s>3<s>1]"
+ "[(0-12)s:Frankenstein|_0$<i>0<i>12|"
+ + "<>:nn$<b>64<i>0<i>12<i>1<b>0<s>3|"
+ + "<>:np$<b>64<i>0<i>13<i>1<b>0<s>2|"
+ + "<>:s$<b>64<i>0<i>37<i>4<b>0<s>1|"
+ + "<:stanford/d:tag$<b>32<i>1<s>3<s>1]"
- + "[(14-19)s:treat|_1$<i>14<i>19|"
- + "<>:vb$<b>64<i>14<i>19<i>2<b>0<s>1|"
+ + "[(14-19)s:treat|_1$<i>14<i>19|"
+ + "<>:vb$<b>64<i>14<i>19<i>2<b>0<s>1|"
+ "<>:vp$<b>64<i>14<i>36<i>4<b>0<s>2|"
- + ">:stanford/d:tag$<b>32<i>0<s>1<s>3|"
- + ">:stanford/d:tag$<b>32<i>3<s>1<s>1|"
- + ">:stanford/d:tag$<b>32<i>4<s>1<s>1]"
+ + ">:stanford/d:tag$<b>32<i>0<s>1<s>3|"
+ + ">:stanford/d:tag$<b>32<i>3<s>1<s>1|"
+ + ">:stanford/d:tag$<b>32<i>4<s>1<s>1]"
- + "[(20-22)s:my|_2$<i>20<i>22|"
- + "<>:prp$<b>64<i>20<i>22<i>3<b>0<s>1|"
- + "<>:np$<b>64<i>20<i>31<i>3<b>0<s>2]"
+ + "[(20-22)s:my|_2$<i>20<i>22|"
+ + "<>:prp$<b>64<i>20<i>22<i>3<b>0<s>1|"
+ + "<>:np$<b>64<i>20<i>31<i>3<b>0<s>2]"
- + "[(23-31)s:daughter|_3$<i>23<i>31|"
- + "<>:nn$<b>64<i>23<i>31<i>4<b>0<s>1|"
- + ">:stanford/d:tag$<b>32<i>2<s>1<s>1]"
+ + "[(23-31)s:daughter|_3$<i>23<i>31|"
+ + "<>:nn$<b>64<i>23<i>31<i>4<b>0<s>1|"
+ + ">:stanford/d:tag$<b>32<i>2<s>1<s>1]"
- + "[(32-36)s:well|_4$<i>32<i>36|"
- + "<>:rb$<b>64<i>32<i>36<i>5<b>0<s>1|"
- + "<>:advp$<b>64<i>32<i>36<i>4<b>0<s>2]");
+ + "[(32-36)s:well|_4$<i>32<i>36|"
+ + "<>:rb$<b>64<i>32<i>36<i>5<b>0<s>1|"
+ + "<>:advp$<b>64<i>32<i>36<i>4<b>0<s>2]");
return fd;
}
@@ -281,95 +281,95 @@
"tokens",
"Frankenstein, treat my daughter well. She is the one that saved your master who you hold so dear.",
- "[(0-12)s:Frankenstein|_0$<i>0<i>12|"
- + "<>:nn$<b>64<i>0<i>12<i>1<b>0<s>3|"
- + "<>:np$<b>64<i>0<i>13<i>1<b>0<s>2|"
+ "[(0-12)s:Frankenstein|_0$<i>0<i>12|"
+ + "<>:nn$<b>64<i>0<i>12<i>1<b>0<s>3|"
+ + "<>:np$<b>64<i>0<i>13<i>1<b>0<s>2|"
+ "<>:s$<b>64<i>0<i>37<i>5<b>0<s>1|"
- + "<:stanford/d:tag$<b>32<i>1<s>3<s>1]"
+ + "<:stanford/d:tag$<b>32<i>1<s>3<s>1]"
- + "[(14-19)s:treat|_1$<i>14<i>19|"
- + "<>:vb$<b>64<i>14<i>19<i>2<b>0<s>1|"
- + "<>:vp$<b>64<i>14<i>36<i>5<b>0<s>2|"
- + ">:stanford/d:tag$<b>32<i>0<s>1<s>2|"
- + ">:stanford/d:tag$<b>32<i>3<s>1<s>1|"
- + ">:stanford/d:tag$<b>32<i>4<s>1<s>1]"
+ + "[(14-19)s:treat|_1$<i>14<i>19|"
+ + "<>:vb$<b>64<i>14<i>19<i>2<b>0<s>1|"
+ + "<>:vp$<b>64<i>14<i>36<i>5<b>0<s>2|"
+ + ">:stanford/d:tag$<b>32<i>0<s>1<s>2|"
+ + ">:stanford/d:tag$<b>32<i>3<s>1<s>1|"
+ + ">:stanford/d:tag$<b>32<i>4<s>1<s>1]"
+ "[(20-22)s:my|_2$<i>20<i>22|"
+ "<>:prp$<b>64<i>20<i>22<i>3<b>0<s>1|"
- + "<>:np$<b>64<i>20<i>31<i>4<b>0<s>2]"
+ + "<>:np$<b>64<i>20<i>31<i>4<b>0<s>2]"
- + "[(23-31)s:daughter|_3$<i>23<i>31|"
- + "<>:nn$<b>64<i>23<i>31<i>4<b>0<s>1|"
- + ">:stanford/d:tag$<b>32<i>2<s>21<s>1]"
+ + "[(23-31)s:daughter|_3$<i>23<i>31|"
+ + "<>:nn$<b>64<i>23<i>31<i>4<b>0<s>1|"
+ + ">:stanford/d:tag$<b>32<i>2<s>21<s>1]"
+ "[(32-36)s:well|_4$<i>32<i>36|"
- + "<>:rb$<b>64<i>32<i>36<i>5<b>0<s>1|"
- + "<>:advp$<b>64<i>32<i>36<i>5<b>0<s>2]"
+ + "<>:rb$<b>64<i>32<i>36<i>5<b>0<s>1|"
+ + "<>:advp$<b>64<i>32<i>36<i>5<b>0<s>2]"
- + "[(38-41)s:She|_5$<i>38<i>41|"
- + "<>:prp$<b>64<i>38<i>41<i>6<b>0<s>3|"
- + "<>:np$<b>64<i>38<i>41<i>6<b>0<s>2|"
- + "<>:s$<b>64<i>38<i>97<i>18<b>0<s>1]"
+ + "[(38-41)s:She|_5$<i>38<i>41|"
+ + "<>:prp$<b>64<i>38<i>41<i>6<b>0<s>3|"
+ + "<>:np$<b>64<i>38<i>41<i>6<b>0<s>2|"
+ + "<>:s$<b>64<i>38<i>97<i>18<b>0<s>1]"
- + "[(42-44)s:is|_6$<i>42<i>44|"
- + "<>:vb$<b>64<i>42<i>44<i>7<b>0<s>1|"
- + "<>:vp$<b>64<i>42<i>96<i>18<b>0<s>2]"
+ + "[(42-44)s:is|_6$<i>42<i>44|"
+ + "<>:vb$<b>64<i>42<i>44<i>7<b>0<s>1|"
+ + "<>:vp$<b>64<i>42<i>96<i>18<b>0<s>2]"
- + "[(45-48)s:the|_7$<i>45<i>48|"
- + "<>:dt$<b>64<i>45<i>48<i>8<b>0<s>3|"
- + "<>:np$<b>64<i>45<i>52<i>9<b>0<s>2|"
- + "<>:np$<b>64<i>45<i>96<i>18<b>0<s>1]"
+ + "[(45-48)s:the|_7$<i>45<i>48|"
+ + "<>:dt$<b>64<i>45<i>48<i>8<b>0<s>3|"
+ + "<>:np$<b>64<i>45<i>52<i>9<b>0<s>2|"
+ + "<>:np$<b>64<i>45<i>96<i>18<b>0<s>1]"
- + "[(49-52)s:one|_8$<i>49<i>52|"
- + "<>:nn$<b>64<i>49<i>52<i>9<b>0<s>1|"
- + ">:stanford/d:tag$<b>32<i>5<s>1<s>3|"
- + ">:stanford/d:tag$<b>32<i>6<s>1<s>1|"
- + ">:stanford/d:tag$<b>32<i>7<s>1<s>3|"
- + ">:stanford/d:tag$<b>32<i>10<s>1<s>1]"
+ + "[(49-52)s:one|_8$<i>49<i>52|"
+ + "<>:nn$<b>64<i>49<i>52<i>9<b>0<s>1|"
+ + ">:stanford/d:tag$<b>32<i>5<s>1<s>3|"
+ + ">:stanford/d:tag$<b>32<i>6<s>1<s>1|"
+ + ">:stanford/d:tag$<b>32<i>7<s>1<s>3|"
+ + ">:stanford/d:tag$<b>32<i>10<s>1<s>1]"
- + "[(53-57)s:that|_9$<i>53<i>57|"
- + "<>:rp$<b>64<i>53<i>57<i>10<b>0<s>1|"
- + "<>:sb$<b>64<i>53<i>96<i>18<b>0<s>2]"
+ + "[(53-57)s:that|_9$<i>53<i>57|"
+ + "<>:rp$<b>64<i>53<i>57<i>10<b>0<s>1|"
+ + "<>:sb$<b>64<i>53<i>96<i>18<b>0<s>2]"
- + "[(58-63)s:saved|_10$<i>58<i>63|"
- + "<>:vb$<b>64<i>58<i>63<i>11<b>0<s>1|"
- + "<>:s$<b>64<i>58<i>96<i>18<b>0<s>2|"
- + "<>:vp$<b>64<i>58<i>96<i>18<b>0<s>3|"
- + ">:stanford/d:tag$<b>32<i>9<s>1<s>1|"
- + ">:stanford/d:tag$<b>32<i>12<s>1<s>1|"
- + ">:stanford/d:tag$<b>32<i>15<s>1<s>33]"
+ + "[(58-63)s:saved|_10$<i>58<i>63|"
+ + "<>:vb$<b>64<i>58<i>63<i>11<b>0<s>1|"
+ + "<>:s$<b>64<i>58<i>96<i>18<b>0<s>2|"
+ + "<>:vp$<b>64<i>58<i>96<i>18<b>0<s>3|"
+ + ">:stanford/d:tag$<b>32<i>9<s>1<s>1|"
+ + ">:stanford/d:tag$<b>32<i>12<s>1<s>1|"
+ + ">:stanford/d:tag$<b>32<i>15<s>1<s>33]"
- + "[(64-68)s:your|_11$<i>64<i>68|"
- + "<>:prp$<b>64<i>64<i>68<i>12<b>0<s>1|"
- + "<>:np$<b>64<i>64<i>75<i>13<b>0<s>2]"
+ + "[(64-68)s:your|_11$<i>64<i>68|"
+ + "<>:prp$<b>64<i>64<i>68<i>12<b>0<s>1|"
+ + "<>:np$<b>64<i>64<i>75<i>13<b>0<s>2]"
- + "[(69-75)s:master|_12$<i>69<i>75|"
- + "<>:nn$<b>64<i>69<i>75<i>13<b>0<s>1|"
- + ">:stanford/d:tag$<b>32<i>11<s>1<s>1]"
+ + "[(69-75)s:master|_12$<i>69<i>75|"
+ + "<>:nn$<b>64<i>69<i>75<i>13<b>0<s>1|"
+ + ">:stanford/d:tag$<b>32<i>11<s>1<s>1]"
- + "[(76-79)s:who|_13$<i>76<i>79|"
- + "<>:rp$<b>64<i>76<i>79<i>14<b>0<s>1|"
- + "<>:sb$<b>64<i>76<i>96<i>18<b>0<s>2]"
+ + "[(76-79)s:who|_13$<i>76<i>79|"
+ + "<>:rp$<b>64<i>76<i>79<i>14<b>0<s>1|"
+ + "<>:sb$<b>64<i>76<i>96<i>18<b>0<s>2]"
- + "[(80-83)s:you|_14$<i>80<i>83|"
- + "<>:prp$<b>64<i>80<i>83<i>15<b>0<s>3|"
- + "<>:np$<b>64<i>80<i>83<i>15<b>0<s>2|"
- + "<>:s$<b>64<i>80<i>96<i>18<b>0<s>1]"
+ + "[(80-83)s:you|_14$<i>80<i>83|"
+ + "<>:prp$<b>64<i>80<i>83<i>15<b>0<s>3|"
+ + "<>:np$<b>64<i>80<i>83<i>15<b>0<s>2|"
+ + "<>:s$<b>64<i>80<i>96<i>18<b>0<s>1]"
- + "[(84-88)s:hold|_15$<i>84<i>88|"
- + "<>:vb$<b>64<i>84<i>88<i>16<b>0<s>2|"
- + "<>:vp$<b>64<i>84<i>96<i>18<b>0<s>1|"
- + ">:stanford/d:tag$<b>32<i>13<s>2<s>1|"
- + ">:stanford/d:tag$<b>32<i>14<s>2<s>3|"
- + ">:stanford/d:tag$<b>32<i>17<s>2<s>1]"
+ + "[(84-88)s:hold|_15$<i>84<i>88|"
+ + "<>:vb$<b>64<i>84<i>88<i>16<b>0<s>2|"
+ + "<>:vp$<b>64<i>84<i>96<i>18<b>0<s>1|"
+ + ">:stanford/d:tag$<b>32<i>13<s>2<s>1|"
+ + ">:stanford/d:tag$<b>32<i>14<s>2<s>3|"
+ + ">:stanford/d:tag$<b>32<i>17<s>2<s>1]"
- + "[(89-91)s:so|_16$<i>89<i>91|"
- + "<>:rb$<b>64<i>89<i>91<i>17<b>0<s>1|"
- + "<>:adjp$<b>64<i>89<i>96<i>18<b>0<s>2]"
+ + "[(89-91)s:so|_16$<i>89<i>91|"
+ + "<>:rb$<b>64<i>89<i>91<i>17<b>0<s>1|"
+ + "<>:adjp$<b>64<i>89<i>96<i>18<b>0<s>2]"
- + "[(92-96)s:dear|_17$<i>92<i>96|"
- + "<>:jj$<b>64<i>92<i>96<i>18<b>0<s>1|"
- + ">:stanford/d:tag$<b>32<i>16<s>1<s>1]");
+ + "[(92-96)s:dear|_17$<i>92<i>96|"
+ + "<>:jj$<b>64<i>92<i>96<i>18<b>0<s>1|"
+ + ">:stanford/d:tag$<b>32<i>16<s>1<s>1]");
return fd;
}
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java
index 6f899a8..c63ac56 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestRelationIndex.java
@@ -76,20 +76,20 @@
"base",
"ceccecdeed",
"[(0-1)s:c$<s>1|_0$<i>0<i>1"
- + "|>:xip/syntax-dep_rel$<b>32<i>6<s>1<s>1]"
+ + "|>:xip/syntax-dep_rel$<b>32<i>6<s>1<s>1]"
+ "[(1-2)s:e$<s>1|_1$<i>1<i>2|"
- + "<:xip/syntax-dep_rel$<b>32<i>9<s>1<s>1|"
- + ">:xip/syntax-dep_rel$<b>32<i>4<s>1<s>1]"
+ + "<:xip/syntax-dep_rel$<b>32<i>9<s>1<s>1|"
+ + ">:xip/syntax-dep_rel$<b>32<i>4<s>1<s>1]"
+ "[(2-3)s:c|_2$<i>2<i>3]"
- + "[(3-4)s:c$<s>1|s:b$<s>2|_3$<i>3<i>4|<:xip/syntax-dep_rel$<b>32<i>9<s>1<s>1]"
- + "[(4-5)s:e$<s>1|s:d$<s>2|_4$<i>4<i>5|<:xip/syntax-dep_rel$<b>32<i>1<s>1<s>1]"
+ + "[(3-4)s:c$<s>1|s:b$<s>2|_3$<i>3<i>4|<:xip/syntax-dep_rel$<b>32<i>9<s>1<s>1]"
+ + "[(4-5)s:e$<s>1|s:d$<s>2|_4$<i>4<i>5|<:xip/syntax-dep_rel$<b>32<i>1<s>1<s>1]"
+ "[(5-6)s:c|_5$<i>5<i>6]"
- + "[(6-7)s:d$<s>1|_6$<i>6<i>7|<:xip/syntax-dep_rel$<b>32<i>1<s>1<s>1]"
+ + "[(6-7)s:d$<s>1|_6$<i>6<i>7|<:xip/syntax-dep_rel$<b>32<i>1<s>1<s>1]"
+ "[(7-8)s:e|_7$<i>7<i>8]"
+ "[(8-9)s:e|s:b|_8$<i>8<i>9]"
- + "[(9-10)s:d$<s>1|_9$<i>9<i>10|"
- + ">:xip/syntax-dep_rel$<b>32<i>1<s>1<s>1|"
- + ">:xip/syntax-dep_rel$<b>32<i>3<s>1<s>1]");
+ + "[(9-10)s:d$<s>1|_9$<i>9<i>10|"
+ + ">:xip/syntax-dep_rel$<b>32<i>1<s>1<s>1|"
+ + ">:xip/syntax-dep_rel$<b>32<i>3<s>1<s>1]");
return fd;
}
@@ -101,23 +101,22 @@
"base",
"ceccecdeed",
"[(0-1)s:c$<s>2|<>:p$<b>64<i>0<i>3<i>3<b>0<s>1|_0$<i>0<i>1|"
- + ">:xip/syntax-dep_rel$<b>35<i>3<i>6<i>9<s>1<s>1<s>2|"
- + ">:xip/syntax-dep_rel$<b>33<i>6<i>9<s>2<s>1|"
+ + ">:xip/syntax-dep_rel$<b>35<i>3<i>6<i>9<s>1<s>1<s>2|"
+ + ">:xip/syntax-dep_rel$<b>33<i>6<i>9<s>2<s>1|"
+ "@:func=subj$<b>18<s>2]"
+ "[(1-2)s:e|_1$<i>1<i>2|<>:p$<b>64<i>1<i>3<i>3<b>0<s>1]"
+ "[(2-3)s:c|_2$<i>2<i>3]"
+ "[(3-4)s:c|s:b|_3$<i>3<i>4]"
+ "[(4-5)s:e|s:d|_4$<i>4<i>5]"
+ "[(5-6)s:c|_5$<i>5<i>6]"
- + "[(6-7)s:d$<s>2|<>:p$<b>64<i>6<i>9<i>9<b>0<s>1|_6$<i>6<i>7|"
- + ">:xip/syntax-dep_rel$<b>34<i>9<i>9<s>1<s>1|"
- + "<:xip/syntax-dep_rel$<b>35<i>9<i>1<i>3<s>1<s>1<s>2|"
- + "<:xip/syntax-dep_rel$<b>34<i>9<i>1<s>1<s>2|"
- + "@:func=obj$<b>18<s>2]"
- + "[(7-8)s:e|_7$<i>7<i>8]"
+ + "[(6-7)s:d$<s>2|<>:p$<b>64<i>6<i>9<i>9<b>0<s>1|_6$<i>6<i>7|"
+ + ">:xip/syntax-dep_rel$<b>34<i>9<i>9<s>1<s>1|"
+ + "<:xip/syntax-dep_rel$<b>35<i>9<i>1<i>3<s>1<s>1<s>2|"
+ + "<:xip/syntax-dep_rel$<b>34<i>9<i>1<s>1<s>2|"
+ + "@:func=obj$<b>18<s>2]" + "[(7-8)s:e|_7$<i>7<i>8]"
+ "[(8-9)s:e|s:b|_8$<i>8<i>9]"
- + "[(9-10)s:d$<s>1|_9$<i>9<i>10|<"
- + ":xip/syntax-dep_rel$<b>33<i>6<i>9<s>2<s>1]");
+ + "[(9-10)s:d$<s>1|_9$<i>9<i>10|<"
+ + ":xip/syntax-dep_rel$<b>33<i>6<i>9<s>2<s>1]");
return fd;
}
@@ -129,67 +128,67 @@
"base",
"Ich kaufe die Blümen für meine Mutter.",
"[(0-3)s:Ich|_0$<i>0<i>3|pos:NN$<s>1|<>:s$<b>64<i>0<i>38<i>7<b>0<s>2|<>:np$<b>64<i>0<i>3<i>1<b>0<s>3|"
- + ">:child-of$<b>33<i>0<i>7<s>3<s>2<s>4|"
- + ">:child-of$<b>33<i>0<i>1<s>1<s>3|"
- + "<:child-of$<b>32<i>0<s>3<s>1|"
- + "<:child-of$<b>35<i>7<i>0<i>1<s>2<s>3|"
- + "<:child-of$<b>35<i>7<i>1<i>7<s>2<s>2|"
- + "<:dep$<b>32<i>0<s>1<s>1|"
+ + ">:child-of$<b>33<i>0<i>7<s>3<s>2<s>4|"
+ + ">:child-of$<b>33<i>0<i>1<s>1<s>3|"
+ + "<:child-of$<b>32<i>0<s>3<s>1|"
+ + "<:child-of$<b>35<i>7<i>0<i>1<s>2<s>3|"
+ + "<:child-of$<b>35<i>7<i>1<i>7<s>2<s>2|"
+ + "<:dep$<b>32<i>0<s>1<s>1|"
+ "@:func=sbj$<b>18<i>7<s>4]"
+
"[(1-2)s:kaufe|_1$<i>4<i>9|pos:V$<s>1|<>:vp$<b>64<i>4<i>38<i>7<b>0<s>2|"
- + ">:child-of$<b>35<i>7<i>0<i>7<s>2<s>2|"
- + ">:child-of$<b>33<i>1<i>7<s>2<s>7|"
- + "<:child-of$<b>34<i>7<i>2<s>2<s>1|"
- + "<:child-of$<b>35<i>7<i>2<i>7<s>2<s>4|"
- + ">:dep$<b>32<i>0<s>1<s>1|"
- + ">:dep$<b>32<i>3<s>1<s>1]"
+ + ">:child-of$<b>35<i>7<i>0<i>7<s>2<s>2|"
+ + ">:child-of$<b>33<i>1<i>7<s>2<s>7|"
+ + "<:child-of$<b>34<i>7<i>2<s>2<s>1|"
+ + "<:child-of$<b>35<i>7<i>2<i>7<s>2<s>4|"
+ + ">:dep$<b>32<i>0<s>1<s>1|"
+ + ">:dep$<b>32<i>3<s>1<s>1]"
+
- "[(2-3)s:die|_2$<i>10<i>13|pos:ART$<s>1|tt:DET$<s>2|"
- + "<>:np$<b>64<i>10<i>20<i>4<b>0<s>3|<>:np$<b>64<i>10<i>38<i>7<b>0<s>4|"
- + ">:child-of$<b>35<i>4<i>2<i>7<s>3<s>4|"
- + ">:child-of$<b>33<i>2<i>4<s>1<s>3|"
- + ">:child-of$<b>35<i>7<i>1<i>7<s>4<s>2|"
- + "<:child-of$<b>34<i>4<i>2<s>3<s>1|"
- + "<:child-of$<b>34<i>4<i>3<s>3<s>1|"
- + "<:child-of$<b>35<i>7<i>2<i>4<s>4<s>3|"
- + "<:child-of$<b>35<i>7<i>4<i>7<s>4<s>2|"
- + ">:parent-of$<b>35<i>7<i>4<i>7<s>4<s>2|"
- + "<:dep$<b>32<i>3<s>1<s>1<s>3|"
+ "[(2-3)s:die|_2$<i>10<i>13|pos:ART$<s>1|tt:DET$<s>2|"
+ + "<>:np$<b>64<i>10<i>20<i>4<b>0<s>3|<>:np$<b>64<i>10<i>38<i>7<b>0<s>4|"
+ + ">:child-of$<b>35<i>4<i>2<i>7<s>3<s>4|"
+ + ">:child-of$<b>33<i>2<i>4<s>1<s>3|"
+ + ">:child-of$<b>35<i>7<i>1<i>7<s>4<s>2|"
+ + "<:child-of$<b>34<i>4<i>2<s>3<s>1|"
+ + "<:child-of$<b>34<i>4<i>3<s>3<s>1|"
+ + "<:child-of$<b>35<i>7<i>2<i>4<s>4<s>3|"
+ + "<:child-of$<b>35<i>7<i>4<i>7<s>4<s>2|"
+ + ">:parent-of$<b>35<i>7<i>4<i>7<s>4<s>2|"
+ + "<:dep$<b>32<i>3<s>1<s>1<s>3|"
+ "@:func=head$<b>18<i>4<s>3]"
+ "[(3-4)s:Blümen|_3$<i>14<i>20|pos:NN$<s>1|"
- + ">:child-of$<b>33<i>2<i>4<s>1<s>3|"
- + "<:dep$<b>32<i>1<s>1<s>1|"
- + ">:dep$<b>32<i>2<s>1<s>1<s>2|"
- + ">:dep$<b>32<i>4<s>1<s>1|"
- + "@:func=obj$<b>18<i>4<s>2]"
+ + ">:child-of$<b>33<i>2<i>4<s>1<s>3|"
+ + "<:dep$<b>32<i>1<s>1<s>1|"
+ + ">:dep$<b>32<i>2<s>1<s>1<s>2|"
+ + ">:dep$<b>32<i>4<s>1<s>1|"
+ + "@:func=obj$<b>18<i>4<s>2]"
+ "[(4-5)s:für|_4$<i>21<i>24|pos:PREP$<s>1|<>:pp$<b>64<i>21<i>38<i>7<b>0<s>2|"
- + ">:child-of$<b>33<i>4<i>7<s>1<s>2|"
- + ">:child-of$<b>35<i>7<i>2<i>7<s>2<s>4|"
- + "<:child-of$<b>34<i>7<i>5<s>2<s>1|"
- + "<:child-of$<b>35<i>7<i>5<i>7<s>2<s>2|"
- + "<:dep$<b>32<i>3<s>1<s>1|"
- + ">:dep$<b>32<i>6<s>1<s>1]"
+ + ">:child-of$<b>33<i>4<i>7<s>1<s>2|"
+ + ">:child-of$<b>35<i>7<i>2<i>7<s>2<s>4|"
+ + "<:child-of$<b>34<i>7<i>5<s>2<s>1|"
+ + "<:child-of$<b>35<i>7<i>5<i>7<s>2<s>2|"
+ + "<:dep$<b>32<i>3<s>1<s>1|"
+ + ">:dep$<b>32<i>6<s>1<s>1]"
+
"[(5-6)s:meine|_5$<i>25<i>30|pos:ART$<s>1|<>:np$<b>64<i>25<i>38<i>7<b>0<s>2|"
- + ">:child-of$<b>33<i>5<i>7<s>1<s>2|"
- + ">:child-of$<b>35<i>7<i>4<i>7<s>2<s>2|"
- + "<:child-of$<b>34<i>7<i>5<s>2<s>1|"
- + "<:child-of$<b>34<i>7<i>6<s>2<s>1|"
- + "<:dep$<b>32<i>6<s>1<s>1<s>3|"
+ + ">:child-of$<b>33<i>5<i>7<s>1<s>2|"
+ + ">:child-of$<b>35<i>7<i>4<i>7<s>2<s>2|"
+ + "<:child-of$<b>34<i>7<i>5<s>2<s>1|"
+ + "<:child-of$<b>34<i>7<i>6<s>2<s>1|"
+ + "<:dep$<b>32<i>6<s>1<s>1<s>3|"
+ "@:func=head$<b>18<i>7<s>3]"
-
+
+ "[(6-7)s:Mutter.|_6$<i>31<i>38|pos:NN$<s>1|"
- + ">:child-of$<b>33<i>5<i>7<s>1<s>2|"
- + ">:dep$<b>32<i>5<s>1<s>1|"
- + "<:dep$<b>32<i>4<s>1<s>1]");
-
+ + ">:child-of$<b>33<i>5<i>7<s>1<s>2|"
+ + ">:dep$<b>32<i>5<s>1<s>1|"
+ + "<:dep$<b>32<i>4<s>1<s>1]");
+
return fd;
}
@@ -324,17 +323,16 @@
kr = ki.search(saq, (short) 20);
// child-of with attr func=sbj
- SpanWithAttributeQuery wq;
- // wq = new SpanWithAttributeQuery(fq, saq, true);
- // kr = ki.search(wq, (short) 20);
- // assertEquals((long) 1, kr.getTotalResults());
- // assertEquals(0, kr.getMatch(0).getStartPos()); // token
- // assertEquals(7, kr.getMatch(0).getEndPos());
+ SpanWithAttributeQuery wq;
+ // wq = new SpanWithAttributeQuery(fq, saq, true);
+ // kr = ki.search(wq, (short) 20);
+ // assertEquals((long) 1, kr.getTotalResults());
+ // assertEquals(0, kr.getMatch(0).getStartPos()); // token
+ // assertEquals(7, kr.getMatch(0).getEndPos());
// child-of without attr func=sbj
- wq = new SpanWithAttributeQuery(fq,
- new SpanAttributeQuery(new SpanTermQuery(new Term("base",
- "@:func=sbj")), true, true),
+ wq = new SpanWithAttributeQuery(fq, new SpanAttributeQuery(
+ new SpanTermQuery(new Term("base", "@:func=sbj")), true, true),
true);
kr = ki.search(wq, (short) 20);
assertEquals((long) 12, kr.getTotalResults());
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java
index a43ce0b..78d623c 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestWithinIndex.java
@@ -359,8 +359,7 @@
"h h i j h i j h i j ",
"[s:h|_0$<i>0<i>3|<>:a$<b>64<i>0<i>12<i>3<b>0|"
+ "<>:a$<b>64<i>0<i>24<i>7<b>0|"
- + "<>:a$<b>64<i>0<i>30<i>9<b>0]"
- + // 1
+ + "<>:a$<b>64<i>0<i>30<i>9<b>0]" + // 1
"[s:h|_1$<i>3<i>6]" + // 2
"[s:i|_2$<i>6<i>9]" + // 3
"[s:j|_3$<i>9<i>12]" + // 4
@@ -433,8 +432,7 @@
fd.addTV("base", "h h i j h i j h i j h ",
"[(0-3)s:h|<>:a$<b>64<i>0<i>12<i>3<b>0|"
+ "<>:a$<b>64<i>0<i>21<i>6<b>0|"
- + "<>:a$<b>64<i>0<i>30<i>9<b>0]"
- + // 1
+ + "<>:a$<b>64<i>0<i>30<i>9<b>0]" + // 1
"[(3-6)s:h]" + // 2
"[(6-9)s:i]" + // 3
"[(9-12)s:j]" + // 4
@@ -500,8 +498,7 @@
fd.addTV("base", "h h i j h i j h i j h i ",
"[(0-3)s:h|<>:a$<b>64<i>0<i>15<i>4<b>0|"
+ "<>:a$<b>64<i>0<i>21<i>7<b>0|"
- + "<>:a$<b>64<i>0<i>30<i>10<b>0]"
- + // 1
+ + "<>:a$<b>64<i>0<i>30<i>10<b>0]" + // 1
"[(3-6)s:h]" + // 2
"[(6-9)s:i]" + // 3
"[(9-12)s:j]" + // 4
@@ -667,8 +664,7 @@
// <a><a><a>u</a></a></a>
FieldDocument fd = new FieldDocument();
- fd.addTV("base", "xyz",
- "[(0-3)s:xyz|<>:a$<b>64<i>0<i>3<i>0<b>0|"
+ fd.addTV("base", "xyz", "[(0-3)s:xyz|<>:a$<b>64<i>0<i>3<i>0<b>0|"
+ "<>:a$<b>64<i>0<i>3<i>0<b>0|" + "<>:a$<b>64<i>0<i>3<i>0<b>0|"
+ "<>:b$<b>64<i>0<i>3<i>0<b>0]");
ki.addDoc(fd);
@@ -680,10 +676,9 @@
+ "<>:b$<b>64<i>0<i>36<i>12<b>0]"
+ "[(3-6)s:y|<>:a$<b>64<i>3<i>27<i>9<b>0]"
+ "[(6-9)s:z|<>:a$<b>64<i>6<i>18<i>6<b>0]"
- + "[(9-12)s:c]"
- + "[(12-15)s:d]" + "[(15-18)s:e]" + "[(18-21)s:c]"
- + "[(21-24)s:d]" + "[(24-27)s:e]" + "[(27-30)s:c]"
- + "[(30-33)s:d]" + "[(33-36)s:e]");
+ + "[(9-12)s:c]" + "[(12-15)s:d]" + "[(15-18)s:e]"
+ + "[(18-21)s:c]" + "[(21-24)s:d]" + "[(24-27)s:e]"
+ + "[(27-30)s:c]" + "[(30-33)s:d]" + "[(33-36)s:e]");
ki.addDoc(fd);
// xyz
@@ -699,22 +694,20 @@
+ "[(3-6)s:y|<>:a$<b>64<i>3<i>6<i>9<b>0|"
+ "<>:b$<b>64<i>3<i>6<i>9<b>0]"
+ "[(6-9)s:z|<>:a$<b>64<i>6<i>9<i>6<b>0]"
- + "[(9-12)s:k]"
- + "[(12-15)s:l]" + "[(15-18)s:m]" + "[(18-21)s:k]"
- + "[(21-24)s:l]" + "[(24-27)s:m]" + "[(27-30)s:k]"
- + "[(30-33)s:l]" + "[(33-36)s:m]");
+ + "[(9-12)s:k]" + "[(12-15)s:l]" + "[(15-18)s:m]"
+ + "[(18-21)s:k]" + "[(21-24)s:l]" + "[(24-27)s:m]"
+ + "[(27-30)s:k]" + "[(30-33)s:l]" + "[(33-36)s:m]");
ki.addDoc(fd);
// <a><a><a>h</a>hhij</a>hij</a>hij</a>
fd = new FieldDocument();
- fd.addTV("base", "h i j h i j h i j ",
- "[(0-3)s:h|"
+ fd.addTV("base", "h i j h i j h i j ", "[(0-3)s:h|"
+ "<>:a$<b>64<i>0<i>18<i>3<b>0|"
+ "<>:a$<b>64<i>0<i>27<i>6<b>0|"
- + "<>:a$<b>64<i>0<i>36<i>9<b>0]"
- + "[(3-6)s:h]" + "[(12-15)s:i]" + "[(15-18)s:j]"
- + "[(18-21)s:h]" + "[(21-24)s:i]" + "[(24-27)s:j]"
- + "[(27-30)s:h]" + "[(30-33)s:i]" + "[(33-36)s:j]");
+ + "<>:a$<b>64<i>0<i>36<i>9<b>0]" + "[(3-6)s:h]"
+ + "[(12-15)s:i]" + "[(15-18)s:j]" + "[(18-21)s:h]"
+ + "[(21-24)s:i]" + "[(24-27)s:j]" + "[(27-30)s:h]"
+ + "[(30-33)s:i]" + "[(33-36)s:j]");
ki.addDoc(fd);
// xyz
@@ -769,7 +762,9 @@
// Er schrie: <s>"Das war ich!"</s>
FieldDocument fd = new FieldDocument();
fd = new FieldDocument();
- fd.addTV("base", "Er schrie: \"Das war ich!\" und ging.",
+ fd.addTV(
+ "base",
+ "Er schrie: \"Das war ich!\" und ging.",
"[(0-2)s:Er|_0$<i>0<i>3]"
+ "[(3-9)s:schrie|_1$<i>3<i>9]"
+ "[(12-15)s:Das|_2$<i>12<i>15|<>:sentence$<b>64<i>11<i>25<i>5<b>0]"
@@ -859,16 +854,12 @@
// Case 1, 6, 7, 13
// xy<a><a>x</a>b<a>c</a></a>x
FieldDocument fd = new FieldDocument();
- fd.addTV(
- "base",
- "x y x b c x ",
- "[(0-3)s:x|_0$<i>0<i>3]"
- + "[(3-6)s:y|_1$<i>3<i>6]"
+ fd.addTV("base", "x y x b c x ", "[(0-3)s:x|_0$<i>0<i>3]"
+ + "[(3-6)s:y|_1$<i>3<i>6]"
+ "[(6-9)s:x|_2$<i>6<i>9|<>:a$<b>64<i>6<i>9<i>3<b>0|"
- + "<>:a$<b>64<i>6<i>15<i>5<b>0]"
- + "[(9-12)s:b|_3$<i>9<i>12]"
+ + "<>:a$<b>64<i>6<i>15<i>5<b>0]" + "[(9-12)s:b|_3$<i>9<i>12]"
+ "[(12-15)s:c|_4$<i>12<i>15|<>:a$<b>64<i>12<i>15<i>5<b>0]"
- + "[(15-18)s:x|_5$<i>15<i>18]");
+ + "[(15-18)s:x|_5$<i>15<i>18]");
ki.addDoc(fd);
// Save documents
@@ -896,7 +887,9 @@
// hij<a>hi<a>h<a>ij</a></a>hi</a>
FieldDocument fd = new FieldDocument();
- fd.addTV("base", "hijhihijhi",
+ fd.addTV(
+ "base",
+ "hijhihijhi",
"[(0-1)s:h|i:h|_0$<i>0<i>1|-:a$<i>3|-:t$<i>10]"
+ "[(1-2)s:i|i:i|_1$<i>1<i>2]"
+ "[(2-3)s:j|i:j|_2$<i>2<i>3]"
@@ -939,7 +932,9 @@
// 2,5,8,12,13
// h<a><a>i</a>j</a><a>h</a>i j<a>h i</a>j
FieldDocument fd = new FieldDocument();
- fd.addTV("base", "hijhi jh ij",
+ fd.addTV(
+ "base",
+ "hijhi jh ij",
"[(0-1)s:h|i:h|_0$<i>0<i>1|-:a$<i>4|-:t$<i>9]"
+ "[(1-2)s:i|i:i|_1$<i>1<i>2|<>:a$<b>64<i>1<i>2<i>2<b>0|"
+ "<>:a$<b>64<i>1<i>3<i>3<b>0]"
@@ -974,7 +969,9 @@
// 4,5,11,13
// x<a>x h</a>i j h<a>i j</a>
FieldDocument fd = new FieldDocument();
- fd.addTV("base", "xx hi j hi j",
+ fd.addTV(
+ "base",
+ "xx hi j hi j",
"[(0-1)s:x|i:x|_0$<i>0<i>1|-:a$<i>2|-:t$<i>8]"
+ "[(1-2)s:x|i:x|_1$<i>1<i>2|<>:a$<b>64<i>1<i>4<i>3<b>0]"
+ "[(3-4)s:h|i:h|_2$<i>3<i>4]"
@@ -1008,7 +1005,9 @@
KrillIndex ki = new KrillIndex();
FieldDocument fd = new FieldDocument();
// <a>xx <e>hi j <e>hi j</e></e></a>
- fd.addTV("base", "xx hi j hi j",
+ fd.addTV(
+ "base",
+ "xx hi j hi j",
"[(0-1)s:x|i:x|_0$<i>0<i>1|<>:a$<b>64<i>1<i>12<i>8<b>0]"
+ "[(1-2)s:x|i:x|_1$<i>1<i>2]"
+ "[(3-4)s:h|i:h|_2$<i>3<i>4|<>:e$<b>64<i>3<i>12<i>8<b>0]"
diff --git a/src/test/java/de/ids_mannheim/korap/response/TestResponse.java b/src/test/java/de/ids_mannheim/korap/response/TestResponse.java
index 43222c7..c8cf691 100644
--- a/src/test/java/de/ids_mannheim/korap/response/TestResponse.java
+++ b/src/test/java/de/ids_mannheim/korap/response/TestResponse.java
@@ -171,6 +171,7 @@
assertTrue(kresp.hasTimeExceeded());
};
+
@Test
public void testResponseJSONadd () throws IOException {
Response resp = new Response();
diff --git a/src/test/java/de/ids_mannheim/korap/search/TestKrill.java b/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
index 4c69178..e7a6f2f 100644
--- a/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
+++ b/src/test/java/de/ids_mannheim/korap/search/TestKrill.java
@@ -852,15 +852,14 @@
// Construct index
KrillIndex ki = new KrillIndex();
ki.addDoc(1, getClass().getResourceAsStream("/goe/AGX-00002.json"),
- false);
+ false);
ki.addDoc(2, getClass().getResourceAsStream("/bzk/D59-00089.json.gz"),
- true);
+ true);
ki.commit();
-
+
// ({1:Sonne []* Erde} | {2: Erde []* Sonne})
String json = getString(getClass().getResource(
- "/queries/bugs/tokendistancespan_bug.jsonld").getFile()
- );
+ "/queries/bugs/tokendistancespan_bug.jsonld").getFile());
Krill ks = new Krill(json);
Result kr = ks.apply(ki);
@@ -951,8 +950,7 @@
// Construct index
KrillIndex ki = new KrillIndex();
// Indexing test files
- for (String i : new String[] { "00001",
- "00002", "00003", "00004",
+ for (String i : new String[] { "00001", "00002", "00003", "00004",
"00005", "00006", "02439" }) {
ki.addDoc(
getClass().getResourceAsStream("/wiki/" + i + ".json.gz"),
diff --git a/src/test/java/de/ids_mannheim/korap/server/TestResource.java b/src/test/java/de/ids_mannheim/korap/server/TestResource.java
index 966d6e7..2f1c128 100644
--- a/src/test/java/de/ids_mannheim/korap/server/TestResource.java
+++ b/src/test/java/de/ids_mannheim/korap/server/TestResource.java
@@ -136,13 +136,14 @@
}
};
- String json = StringfromFile(getClass().getResource("/wiki/02439.json").getFile());
+ String json = StringfromFile(getClass().getResource("/wiki/02439.json")
+ .getFile());
Entity jsonE = Entity.json(json);
try {
// Put new documents to the index
resp = target.path("/index/02439").request("application/json")
- .put(jsonE, String.class);
+ .put(jsonE, String.class);
res = mapper.readTree(resp);
@@ -151,8 +152,7 @@
assertEquals("milena", res.at("/meta/node").asText());
}
catch (Exception e) {
- fail("Server response failed " + e.getMessage()
- + " (Known issue)");
+ fail("Server response failed " + e.getMessage() + " (Known issue)");
};
// Commit!
@@ -163,6 +163,7 @@
assertEquals(683, res.at("/messages/0/0").asInt());
};
+
@Test
public void testCollection () throws IOException {