You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/01/25 12:41:15 UTC
[GitHub] [lucene-solr] donnerpeter opened a new pull request #2243: LUCENE-9698: Hunspell: reuse char[] when possible when stripping affix
donnerpeter opened a new pull request #2243:
URL: https://github.com/apache/lucene-solr/pull/2243
<!--
_(If you are a project committer then you may remove some/all of the following template.)_
Before creating a pull request, please file an issue in the ASF Jira system for Lucene or Solr:
* https://issues.apache.org/jira/projects/LUCENE
* https://issues.apache.org/jira/projects/SOLR
You will need to create an account in Jira in order to create an issue.
The title of the PR should reference the Jira issue number in the form:
* LUCENE-####: <short description of problem or changes>
* SOLR-####: <short description of problem or changes>
LUCENE and SOLR must be fully capitalized. A short description helps people scanning pull requests for items they can work on.
Properly referencing the issue in the title ensures that Jira is correctly updated with code review comments and commits. -->
# Description
There's no need to allocate another char[] if we can analyze a sub-array of what we already have
# Solution
In addition to `char[]` and `int length`, pass `int offset` everywhere, and adjust offset/length instead of allocating a new array, when an affix is removed and nothing is added in its place.
# Tests
No behavior change, no new tests
# Checklist
Please review the following and check all that apply:
- [ ] I have reviewed the guidelines for [How to Contribute](https://wiki.apache.org/solr/HowToContribute) and my code conforms to the standards described there to the best of my ability.
- [ ] I have created a Jira issue and added the issue ID to my pull request title.
- [ ] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended)
- [ ] I have developed this patch against the `master` branch.
- [ ] I have run `./gradlew check`.
- [ ] I have added tests for my changes.
- [ ] I have added documentation for the [Ref Guide](https://github.com/apache/lucene-solr/tree/master/solr/solr-ref-guide) (for Solr changes only).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
[GitHub] [lucene-solr] donnerpeter commented on a change in pull request #2243: LUCENE-9698: Hunspell: reuse char[] when possible when stripping affix
Posted by GitBox <gi...@apache.org>.
donnerpeter commented on a change in pull request #2243:
URL: https://github.com/apache/lucene-solr/pull/2243#discussion_r564429159
##########
File path: lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Stemmer.java
##########
@@ -403,7 +408,12 @@ private CharsRef newStem(char[] buffer, int length, IntsRef forms, int formID) {
return stems;
}
- private char[] stripAffix(char[] word, int length, int affixLen, int affix, boolean isPrefix) {
+ /**
+ * @return null if affix conditions isn't met; the same char[] if the affix has no strip data and
Review comment:
"stripping" has a bit different meaning in Hunspell. Googling for "deaffixation" yields some results, some even seem to be by a native speaker (https://books.google.de/books?id=4A44AAAAIAAJ&pg=PA24&lpg=PA24&dq=deaffixation&source=bl&ots=bjtSTczny5&sig=ACfU3U1ujhDJpEFTR3BD_MiHYqgMJKbHMQ&hl=en&sa=X&ved=2ahUKEwjNw_uQurnuAhWvx4UKHXJoCQ0Q6AEwAnoECAUQAg#v=onepage&q=deaffixation&f=false), but rather few, indeed. How about "affix removal"?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
[GitHub] [lucene-solr] dweiss commented on a change in pull request #2243: LUCENE-9698: Hunspell: reuse char[] when possible when stripping affix
Posted by GitBox <gi...@apache.org>.
dweiss commented on a change in pull request #2243:
URL: https://github.com/apache/lucene-solr/pull/2243#discussion_r564331661
##########
File path: lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Stemmer.java
##########
@@ -403,7 +408,12 @@ private CharsRef newStem(char[] buffer, int length, IntsRef forms, int formID) {
return stems;
}
- private char[] stripAffix(char[] word, int length, int affixLen, int affix, boolean isPrefix) {
+ /**
+ * @return null if affix conditions isn't met; the same char[] if the affix has no strip data and
Review comment:
I'd make it clearer that it's "the same *reference* to char[] if the affix....". I did wonder a bit why you're comparing array refs directly (above) for a while. Also, not sure "de-affixation" is an English word (although I'm not a native English speaker too); "[...] after affix stripping" would be more legible, maybe?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
[GitHub] [lucene-solr] dweiss merged pull request #2243: LUCENE-9698: Hunspell: reuse char[] when possible when stripping affix
Posted by GitBox <gi...@apache.org>.
dweiss merged pull request #2243:
URL: https://github.com/apache/lucene-solr/pull/2243
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org