-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17be9cf
commit 33db175
Showing
2 changed files
with
37 additions
and
31 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
core/src/test/scala/ai/lum/odinson/metadata/TestJoinQueries.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package ai.lum.odinson.metadata | ||
|
||
import ai.lum.odinson.test.utils.OdinsonTest | ||
|
||
class TestJoinQueries extends OdinsonTest { | ||
|
||
"Odinson" should "match simple patterns with open range quantifiers and a metadata filter" in { | ||
|
||
// create in-memory engine w/ a single doc w/ a single sentence | ||
val ee = mkExtractorEngine("step-bros") | ||
// "John", "C.", "Reilly", "played" ... | ||
val pattern = "[lemma=play] >nsubj [tag=NNP]{,3}" | ||
val mf = "doc_id == 'step-bros'" | ||
val oq = ee.mkFilteredQuery(query = pattern, metadataFilter = mf) | ||
|
||
val res = ee.query(oq) | ||
|
||
numMatches(res) should be (1) | ||
existsMatchWithSpan(odinResults = res, doc = 0, start = 0, end = 3) should be (true) | ||
} | ||
|
||
it should "match simple patterns with exact range quantifiers (>=2) and a metadata filter" in { | ||
|
||
// create in-memory engine w/ a single doc w/ a single sentence | ||
val ee = mkExtractorEngine("step-bros") | ||
// "John", "C.", "Reilly", "played" ... | ||
val pattern = "[lemma=play] >nsubj [tag=NNP]{3}" | ||
val mf = "doc_id == 'step-bros'" | ||
val oq = ee.mkFilteredQuery(query = pattern, metadataFilter = mf) | ||
|
||
val res = ee.query(oq) | ||
|
||
numMatches(res) should be (1) | ||
existsMatchWithSpan(odinResults = res, doc = 0, start = 0, end = 3) should be (true) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters