DocPrompting: Accept lemmatizeNodeQuery as a lemma search
The test required the lemma to be asked for through the annotation layer,
as the Readme shows it, and counted collocationAnalysis' own
lemmatizeNodeQuery as a failure - although that parameter builds the very
same query from a plain word, so that both are correct answers to the
task.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Change-Id: I231e5104d9dca0ed3720ef104a0d1146ed4ceb23
diff --git a/tests/testthat/test-readme-against-llm.R b/tests/testthat/test-readme-against-llm.R
index f447523..3454709 100644
--- a/tests/testthat/test-readme-against-llm.R
+++ b/tests/testthat/test-readme-against-llm.R
@@ -303,7 +303,15 @@
# Basic checks on the generated code
expect_true(grepl("KorAPConnection", generated_code), "Generated code should include KorAPConnection")
expect_true(grepl("collocationAnalysis", generated_code), "Generated code should include collocationAnalysis")
- expect_true(grepl("tt/l=leverage", generated_code), "Generated code should include the search the lemma 'leverage'")
+ # both ways of asking for the lemma are correct: the annotation layer in the
+ # query, as the Readme shows it, or collocationAnalysis' lemmatizeNodeQuery,
+ # which builds the same query from a plain word
+ expect_true(grepl("leverage", generated_code), "Generated code should include the node 'leverage'")
+ expect_true(
+ grepl("tt/l=leverage", generated_code) ||
+ grepl("lemmatizeNodeQuery\\s*=\\s*T", generated_code),
+ "Generated code should search for the lemma, via tt/l= or lemmatizeNodeQuery = TRUE"
+ )
# expect_true(grepl("auth", generated_code), "Generated code should include auth() for collocation analysis")
expect_true(grepl("instance/english", generated_code, fixed = TRUE), "Generated code should include the specified KorAP URL")