Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate OpenNLP 'ant train-test-models' to Gradle #14198

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

msfroh
Copy link
Contributor

@msfroh msfroh commented Feb 5, 2025

Description

This resurrects the OpenNLP model training task from Ant (https://github.com/apache/lucene-solr/blob/releases/lucene-solr/8.11.2/lucene/analysis/opennlp/build.xml#L52-L84) to Gradle.

I ran the new regenerate task to regenerate the models with the new OpenNLP 2.5.3, which broke some of the chunking tests. I don't really understand the chunking output, so I just updated the test to reflect the new output. (The differences are pretty small.)

Edit: I checked the OpenNLP chunker docs and I think I understand the difference now. I think the older model wasn't properly the identifying verb group. So whereas the first sentence was previously a single long noun group:

Sentence number 1 has 6 words.

Now it's three groups (because the verb phrase gets its own group, which is consistent with the example in the OpenNLP manual):

Sentence number 1
has
6 words.

Resolves #13002

}
}

tasks.register('regenerate') { dependsOn 'trainTestModels' }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those regenerate tasks are often more complex than just dependencies - they have inputs and outputs to detect when the generation task can be skipped. Is the output from this opennlp always the same (deterministic)? If so, we could plug it into the regenerate pipeline - I can help, probably. But if it's not deterministic then I'd remove this regenerate line entirely and leave the task to be manually invoked when needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh... the LLM that helped me to migrate the Ant build to Gradle (after I spent an hour trying to do it by hand) copied the regenerate task from this line: https://github.com/apache/lucene-solr/blob/releases/lucene-solr/8.11.2/lucene/analysis/opennlp/build.xml#L117

I think the output is deterministic, but will change when a) OpenNLP is upgraded again or b) someone updates the training files.

Assuming neither of those happen very often (as has been the case recently), I think leaving it manual makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope -- I checked by running the trainTestModels task again and the model files all had something change. So, I'm going to remove this line and we can stick to manual training as needed. 👍

We can retrain models manually if/when needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

migrate OpenNLP 'ant train-test-models' to Gradle
2 participants