Skip to content

Commit

Permalink
Refactor tests to reflect issue
Browse files Browse the repository at this point in the history
  • Loading branch information
myedibleenso committed Feb 17, 2024
1 parent 17be9cf commit 33db175
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 31 deletions.
36 changes: 36 additions & 0 deletions core/src/test/scala/ai/lum/odinson/metadata/TestJoinQueries.scala
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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ai.lum.odinson.test.utils.OdinsonTest

class TestQuantifiedPatterns extends OdinsonTest {

"Odinson" should "match simple patterns with exact range quantifiers" in {
"Odinson" should "match simple patterns with exact range quantifiers (>=2)" in {

// create in-memory engine w/ a single doc w/ a single sentence
val ee = mkExtractorEngine("step-bros")
Expand All @@ -16,34 +16,4 @@ class TestQuantifiedPatterns extends OdinsonTest {
numMatches(res) should be (1)
existsMatchWithSpan(odinResults = res, doc = 0, start = 0, end = 3) should be (true)
}

it 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)
}
}

0 comments on commit 33db175

Please # to comment.