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/02/18 09:26:22 UTC

[GitHub] [lucene-solr] donnerpeter opened a new pull request #2397: LUCENE-9776: Hunspell: allow to inflect the last part of COMPOUNDRULE compounds

donnerpeter opened a new pull request #2397:
URL: https://github.com/apache/lucene-solr/pull/2397


   <!--
   _(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
   
   To support Dutch "15-urige" (inflected "15-urig")
   
   # Solution
   
   To allow affixes and honor ONLYINCOMPOUND there but not COMPOUNDFLAG/COMPOUNDEND, introduce yet another compound word context  COMPOUND_RULE_END, use it in the last part of a compound rule.
   
   # Tests
   
   `compoundrule4` expanded
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [x] 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.
   - [x] I have created a Jira issue and added the issue ID to my pull request title.
   - [x] 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)
   - [x] I have developed this patch against the `master` branch.
   - [x] I have run `./gradlew check`.
   - [x] 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 #2397: LUCENE-9776: Hunspell: allow to inflect the last part of COMPOUNDRULE compounds

Posted by GitBox <gi...@apache.org>.
donnerpeter commented on a change in pull request #2397:
URL: https://github.com/apache/lucene-solr/pull/2397#discussion_r578346118



##########
File path: lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Stemmer.java
##########
@@ -540,8 +533,8 @@ private boolean isAffixCompatible(
       if (!isPrefix && dictionary.hasFlag(append, dictionary.compoundForbid)) {
         return false;
       }
-      WordContext allowed = isPrefix ? WordContext.COMPOUND_BEGIN : WordContext.COMPOUND_END;
-      if (context != allowed && !dictionary.hasFlag(append, dictionary.compoundPermit)) {
+      if (!context.isAffixAllowedWithoutSpecialPermit(isPrefix)

Review comment:
       This check becomes a bit more complicated with the addition of a new context, so it's extracted to a method




----------------------------------------------------------------
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 #2397: LUCENE-9776: Hunspell: allow to inflect the last part of COMPOUNDRULE compounds

Posted by GitBox <gi...@apache.org>.
donnerpeter commented on a change in pull request #2397:
URL: https://github.com/apache/lucene-solr/pull/2397#discussion_r578343944



##########
File path: lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Hunspell.java
##########
@@ -397,8 +398,7 @@ private boolean checkCompoundRules(
       if (forms != null) {
         words.add(forms);
 
-        if (dictionary.compoundRules != null

Review comment:
       null check is done by the caller of this method




----------------------------------------------------------------
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 #2397: LUCENE-9776: Hunspell: allow to inflect the last part of COMPOUNDRULE compounds

Posted by GitBox <gi...@apache.org>.
donnerpeter commented on a change in pull request #2397:
URL: https://github.com/apache/lucene-solr/pull/2397#discussion_r578345671



##########
File path: lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Stemmer.java
##########
@@ -247,19 +247,12 @@ boolean doStem(
         if (dictionary.hasFlag(entryId, dictionary.needaffix)) {
           continue;
         }
-        // we can't add this form, it only belongs inside a compound word
-        if (!context.isCompound() && dictionary.hasFlag(entryId, dictionary.onlyincompound)) {
-          continue;
+        if ((context == WordContext.COMPOUND_BEGIN || context == WordContext.COMPOUND_MIDDLE)

Review comment:
       The "compoundforbid" check extracted (and the contexts enumerated), everything else went into an extracted method, since the same logic was needed in `applyAffix`




----------------------------------------------------------------
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 #2397: LUCENE-9776: Hunspell: allow to inflect the last part of COMPOUNDRULE compounds

Posted by GitBox <gi...@apache.org>.
donnerpeter commented on a change in pull request #2397:
URL: https://github.com/apache/lucene-solr/pull/2397#discussion_r578346362



##########
File path: lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Stemmer.java
##########
@@ -550,18 +543,17 @@ private boolean isAffixCompatible(
           && dictionary.hasFlag(append, dictionary.onlyincompound)) {
         return false;
       }
+    } else if (dictionary.hasFlag(append, dictionary.onlyincompound)) {

Review comment:
       Two similar checks from below are now united here




----------------------------------------------------------------
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 #2397: LUCENE-9776: Hunspell: allow to inflect the last part of COMPOUNDRULE compounds

Posted by GitBox <gi...@apache.org>.
donnerpeter commented on a change in pull request #2397:
URL: https://github.com/apache/lucene-solr/pull/2397#discussion_r578344605



##########
File path: lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Hunspell.java
##########
@@ -417,13 +417,17 @@ private boolean checkCompoundRules(
 
   private boolean checkLastCompoundPart(
       char[] wordChars, int start, int length, List<IntsRef> words) {
-    IntsRef forms = dictionary.lookupWord(wordChars, start, length);
-    if (forms == null) return false;
+    IntsRef ref = new IntsRef(new int[1], 0, 1);
+    words.add(ref);

Review comment:
       reuse the "forms" object at the stack top, change its contents for each root candidate




----------------------------------------------------------------
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 #2397: LUCENE-9776: Hunspell: allow to inflect the last part of COMPOUNDRULE compounds

Posted by GitBox <gi...@apache.org>.
dweiss merged pull request #2397:
URL: https://github.com/apache/lucene-solr/pull/2397


   


----------------------------------------------------------------
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