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/04 09:50:50 UTC

[GitHub] [lucene-solr] donnerpeter opened a new pull request #2300: LUCENE-9729: Hunspell: support CHECKCOMPOUNDREP flags

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


   <!--
   _(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
   
   > CHECKCOMPOUNDREP
   
   > Forbid compounding, if the (usually bad) compound word may be a non-compound word with a REP fault. Useful for languages with ‘compound friendly’ orthography.
   
   # Solution
   
   When a new compound word part is about to appear, check that together with the previous one they don't form a misspelled simple word. For that, first introduce `CompoundPart` class (in a separate commit for easier review) to combine this new logic with similar `CHECKCOMPOUNDPATTERN` stuff.
   
   # Tests
   
   `checkcompoundrep` from Hunspell/C++
   
   # 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] dweiss merged pull request #2300: LUCENE-9729: Hunspell: support CHECKCOMPOUNDREP flags

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


   


----------------------------------------------------------------
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 #2300: LUCENE-9729: Hunspell: support CHECKCOMPOUNDREP flags

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



##########
File path: lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/CheckCompoundPattern.java
##########
@@ -38,36 +38,33 @@
     }
 
     int flagSep = parts[1].indexOf("/");
-    endChars = (flagSep < 0 ? parts[1] : parts[1].substring(0, flagSep)).toCharArray();
+    endChars = flagSep < 0 ? parts[1] : parts[1].substring(0, flagSep);
     endFlags = flagSep < 0 ? new char[0] : strategy.parseFlags(parts[1].substring(flagSep + 1));
 
     flagSep = parts[2].indexOf("/");
-    beginChars = (flagSep < 0 ? parts[2] : parts[2].substring(0, flagSep)).toCharArray();
+    beginChars = flagSep < 0 ? parts[2] : parts[2].substring(0, flagSep);
     beginFlags = flagSep < 0 ? new char[0] : strategy.parseFlags(parts[2].substring(flagSep + 1));
 
-    replacement = parts.length == 3 ? null : parts[3].toCharArray();
+    replacement = parts.length == 3 ? null : parts[3];
   }
 
   @Override
   public String toString() {
-    return new String(endChars)
-        + " "
-        + new String(beginChars)
-        + (replacement == null ? "" : " -> " + new String(replacement));
+    return endChars + " " + beginChars + (replacement == null ? "" : " -> " + replacement);
   }
 
   boolean prohibitsCompounding(
       CharsRef word, int breakPos, CharsRef stemBefore, CharsRef stemAfter) {
     if (isNonAffixedPattern(endChars)) {
-      if (!charsMatch(word, breakPos - stemBefore.length, stemBefore.chars)) {

Review comment:
       There was a bug here: `stemBefore.chars` was checked fully, disregarding `offset/length`. Now we pass in `CharSequence` to avoid that

##########
File path: lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/CheckCompoundPattern.java
##########
@@ -38,36 +38,33 @@
     }
 
     int flagSep = parts[1].indexOf("/");
-    endChars = (flagSep < 0 ? parts[1] : parts[1].substring(0, flagSep)).toCharArray();
+    endChars = flagSep < 0 ? parts[1] : parts[1].substring(0, flagSep);
     endFlags = flagSep < 0 ? new char[0] : strategy.parseFlags(parts[1].substring(flagSep + 1));
 
     flagSep = parts[2].indexOf("/");
-    beginChars = (flagSep < 0 ? parts[2] : parts[2].substring(0, flagSep)).toCharArray();
+    beginChars = flagSep < 0 ? parts[2] : parts[2].substring(0, flagSep);
     beginFlags = flagSep < 0 ? new char[0] : strategy.parseFlags(parts[2].substring(flagSep + 1));
 
-    replacement = parts.length == 3 ? null : parts[3].toCharArray();
+    replacement = parts.length == 3 ? null : parts[3];
   }
 
   @Override
   public String toString() {
-    return new String(endChars)
-        + " "
-        + new String(beginChars)
-        + (replacement == null ? "" : " -> " + new String(replacement));
+    return endChars + " " + beginChars + (replacement == null ? "" : " -> " + replacement);
   }
 
   boolean prohibitsCompounding(
       CharsRef word, int breakPos, CharsRef stemBefore, CharsRef stemAfter) {
     if (isNonAffixedPattern(endChars)) {
-      if (!charsMatch(word, breakPos - stemBefore.length, stemBefore.chars)) {

Review comment:
       There was a bug here: `stemBefore.chars` was checked fully, disregarding `offset/length`. Now we pass in `CharSequence` to avoid looking at characters outside the range.




----------------------------------------------------------------
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 #2300: LUCENE-9729: Hunspell: support CHECKCOMPOUNDREP flags

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


   


----------------------------------------------------------------
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 #2300: LUCENE-9729: Hunspell: support CHECKCOMPOUNDREP flags

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



##########
File path: lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/CheckCompoundPattern.java
##########
@@ -38,36 +38,33 @@
     }
 
     int flagSep = parts[1].indexOf("/");
-    endChars = (flagSep < 0 ? parts[1] : parts[1].substring(0, flagSep)).toCharArray();
+    endChars = flagSep < 0 ? parts[1] : parts[1].substring(0, flagSep);
     endFlags = flagSep < 0 ? new char[0] : strategy.parseFlags(parts[1].substring(flagSep + 1));
 
     flagSep = parts[2].indexOf("/");
-    beginChars = (flagSep < 0 ? parts[2] : parts[2].substring(0, flagSep)).toCharArray();
+    beginChars = flagSep < 0 ? parts[2] : parts[2].substring(0, flagSep);
     beginFlags = flagSep < 0 ? new char[0] : strategy.parseFlags(parts[2].substring(flagSep + 1));
 
-    replacement = parts.length == 3 ? null : parts[3].toCharArray();
+    replacement = parts.length == 3 ? null : parts[3];
   }
 
   @Override
   public String toString() {
-    return new String(endChars)
-        + " "
-        + new String(beginChars)
-        + (replacement == null ? "" : " -> " + new String(replacement));
+    return endChars + " " + beginChars + (replacement == null ? "" : " -> " + replacement);
   }
 
   boolean prohibitsCompounding(
       CharsRef word, int breakPos, CharsRef stemBefore, CharsRef stemAfter) {
     if (isNonAffixedPattern(endChars)) {
-      if (!charsMatch(word, breakPos - stemBefore.length, stemBefore.chars)) {

Review comment:
       There was a bug here: `stemBefore.chars` was checked fully, disregarding `offset/length`. Now we pass in `CharSequence` to avoid that




----------------------------------------------------------------
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 #2300: LUCENE-9729: Hunspell: support CHECKCOMPOUNDREP flags

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



##########
File path: lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/CheckCompoundPattern.java
##########
@@ -38,36 +38,33 @@
     }
 
     int flagSep = parts[1].indexOf("/");
-    endChars = (flagSep < 0 ? parts[1] : parts[1].substring(0, flagSep)).toCharArray();
+    endChars = flagSep < 0 ? parts[1] : parts[1].substring(0, flagSep);
     endFlags = flagSep < 0 ? new char[0] : strategy.parseFlags(parts[1].substring(flagSep + 1));
 
     flagSep = parts[2].indexOf("/");
-    beginChars = (flagSep < 0 ? parts[2] : parts[2].substring(0, flagSep)).toCharArray();
+    beginChars = flagSep < 0 ? parts[2] : parts[2].substring(0, flagSep);
     beginFlags = flagSep < 0 ? new char[0] : strategy.parseFlags(parts[2].substring(flagSep + 1));
 
-    replacement = parts.length == 3 ? null : parts[3].toCharArray();
+    replacement = parts.length == 3 ? null : parts[3];
   }
 
   @Override
   public String toString() {
-    return new String(endChars)
-        + " "
-        + new String(beginChars)
-        + (replacement == null ? "" : " -> " + new String(replacement));
+    return endChars + " " + beginChars + (replacement == null ? "" : " -> " + replacement);
   }
 
   boolean prohibitsCompounding(
       CharsRef word, int breakPos, CharsRef stemBefore, CharsRef stemAfter) {
     if (isNonAffixedPattern(endChars)) {
-      if (!charsMatch(word, breakPos - stemBefore.length, stemBefore.chars)) {

Review comment:
       There was a bug here: `stemBefore.chars` was checked fully, disregarding `offset/length`. Now we pass in `CharSequence` to avoid looking at characters outside the range.




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