You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@opennlp.apache.org by "mawiesne (via GitHub)" <gi...@apache.org> on 2023/04/16 15:06:21 UTC

[GitHub] [opennlp-sandbox] mawiesne opened a new pull request, #99: Remove copy of PorterStemmer from summarizer component (DRY)

mawiesne opened a new pull request, #99:
URL: https://github.com/apache/opennlp-sandbox/pull/99

   Change
   -
   - removes copy of PorterStemmer from summarizer component now relying o…n OpenNLP tools' default `PorterStemmer` (DRY)
   - improves `DefaultDocProcessor` to better re-use the stemmer instance and make use of pre-compiled Pattern 
   - improves formatting along the path
   
   Tasks
   -
   Thank you for contributing to Apache OpenNLP.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced 
        in the commit message?
   
   - [ ] Does your PR title start with OPENNLP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
   
   - [x] Has your PR been rebased against the latest commit within the target branch (typically main)?
   
   - [x] Is your initial contribution a single, squashed commit?
   
   ### For code changes:
   - [x] Have you ensured that the full suite of tests is executed via `mvn clean install` at the root opennlp-sandbox folder?
   - [ ] Have you written or updated unit tests to verify your changes?
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](https://www.apache.org/legal/resolved.html#category-a)? 
   - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file in opennlp-sandbox folder?
   - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found in opennlp-sandbox folder?
   
   ### For documentation related changes:
   - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
   
   ### Note:
   Please ensure that once the PR is submitted, you check GitHub Actions for build issues and submit an update to your PR as soon as possible.
   


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

To unsubscribe, e-mail: dev-unsubscribe@opennlp.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [opennlp-sandbox] mawiesne commented on a diff in pull request #99: Remove copy of PorterStemmer from summarizer component (DRY)

Posted by "mawiesne (via GitHub)" <gi...@apache.org>.
mawiesne commented on code in PR #99:
URL: https://github.com/apache/opennlp-sandbox/pull/99#discussion_r1167976028


##########
summarizer/src/main/java/opennlp/summarization/meta/MetaSummarizer.java:
##########
@@ -115,12 +115,10 @@ public List<Score> rankSentences(String article, List<Sentence> sent, int maxWor
   }
 
   //Default Summarization using only lexical chains..
-  public String summarize(String article, int maxWords)
-  {
+  public String summarize(String article, int maxWords) {
     //Build lexical Chains..
     List<Sentence> sent = dp.getSentencesFromStr(article);
-
-    List<Score>finalSc = rankSentences(article, sent, maxWords);
+    List<Score> finalSc = rankSentences(article, sent, maxWords);

Review Comment:
   > Huh, that was probably not even compiling, right?
   
   @kinow Actually, it is accepted by _javac_ to go for sth. like this: 
   
   `Set<String>thisLooksOdd = new HashSet<>();`
   
   It compiles fine. Yet, we both agree it's totally odd to our 👀.
   
   Investigating at https://docs.oracle.com/javase/specs/jls/se11/html/index.html to find out why, for variables declared with use of generics, no space is required. Maybe, it is just a "feature" since generics were introduced in Java.



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

To unsubscribe, e-mail: dev-unsubscribe@opennlp.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [opennlp-sandbox] mawiesne commented on a diff in pull request #99: Remove copy of PorterStemmer from summarizer component (DRY)

Posted by "mawiesne (via GitHub)" <gi...@apache.org>.
mawiesne commented on code in PR #99:
URL: https://github.com/apache/opennlp-sandbox/pull/99#discussion_r1167973038


##########
summarizer/src/main/java/opennlp/summarization/meta/MetaSummarizer.java:
##########
@@ -115,12 +115,10 @@ public List<Score> rankSentences(String article, List<Sentence> sent, int maxWor
   }
 
   //Default Summarization using only lexical chains..
-  public String summarize(String article, int maxWords)
-  {
+  public String summarize(String article, int maxWords) {
     //Build lexical Chains..
     List<Sentence> sent = dp.getSentencesFromStr(article);
-
-    List<Score>finalSc = rankSentences(article, sent, maxWords);
+    List<Score> finalSc = rankSentences(article, sent, maxWords);

Review Comment:
   It was compiling. Maybe a rare whitespace, sort of?
   
   There are tests in summarizer. Don't know exactly whether for this part of the code.



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

To unsubscribe, e-mail: dev-unsubscribe@opennlp.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [opennlp-sandbox] kinow commented on a diff in pull request #99: Remove copy of PorterStemmer from summarizer component (DRY)

Posted by "kinow (via GitHub)" <gi...@apache.org>.
kinow commented on code in PR #99:
URL: https://github.com/apache/opennlp-sandbox/pull/99#discussion_r1167978044


##########
summarizer/src/main/java/opennlp/summarization/meta/MetaSummarizer.java:
##########
@@ -115,12 +115,10 @@ public List<Score> rankSentences(String article, List<Sentence> sent, int maxWor
   }
 
   //Default Summarization using only lexical chains..
-  public String summarize(String article, int maxWords)
-  {
+  public String summarize(String article, int maxWords) {
     //Build lexical Chains..
     List<Sentence> sent = dp.getSentencesFromStr(article);
-
-    List<Score>finalSc = rankSentences(article, sent, maxWords);
+    List<Score> finalSc = rankSentences(article, sent, maxWords);

Review Comment:
   >It compiles fine. Yet, we both agree it's totally odd to our eyes.
   >Investigating at https://docs.oracle.com/javase/specs/jls/se11/html/index.html to find out why, for variables declared with use of generics, no space is required. Maybe, it is just a "feature" since generics were introduced in Java.
   
   #TodayILearned! Thanks @mawiesne !!! 
   
   EDIT: I wonder if every Java parser is able to handle that; I had to use a Java parser written in Python to automate some tasks, if I find that project someday will try that :nerd_face: :neckbeard: 



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

To unsubscribe, e-mail: dev-unsubscribe@opennlp.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [opennlp-sandbox] kinow commented on a diff in pull request #99: Remove copy of PorterStemmer from summarizer component (DRY)

Posted by "kinow (via GitHub)" <gi...@apache.org>.
kinow commented on code in PR #99:
URL: https://github.com/apache/opennlp-sandbox/pull/99#discussion_r1167978044


##########
summarizer/src/main/java/opennlp/summarization/meta/MetaSummarizer.java:
##########
@@ -115,12 +115,10 @@ public List<Score> rankSentences(String article, List<Sentence> sent, int maxWor
   }
 
   //Default Summarization using only lexical chains..
-  public String summarize(String article, int maxWords)
-  {
+  public String summarize(String article, int maxWords) {
     //Build lexical Chains..
     List<Sentence> sent = dp.getSentencesFromStr(article);
-
-    List<Score>finalSc = rankSentences(article, sent, maxWords);
+    List<Score> finalSc = rankSentences(article, sent, maxWords);

Review Comment:
   >It compiles fine. Yet, we both agree it's totally odd to our eyes.
   >Investigating at https://docs.oracle.com/javase/specs/jls/se11/html/index.html to find out why, for variables declared with use of generics, no space is required. Maybe, it is just a "feature" since generics were introduced in Java.
   
   #TodayILearned! Thanks @mawiesne !!! 



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

To unsubscribe, e-mail: dev-unsubscribe@opennlp.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [opennlp-sandbox] mawiesne commented on a diff in pull request #99: Remove copy of PorterStemmer from summarizer component (DRY)

Posted by "mawiesne (via GitHub)" <gi...@apache.org>.
mawiesne commented on code in PR #99:
URL: https://github.com/apache/opennlp-sandbox/pull/99#discussion_r1167976028


##########
summarizer/src/main/java/opennlp/summarization/meta/MetaSummarizer.java:
##########
@@ -115,12 +115,10 @@ public List<Score> rankSentences(String article, List<Sentence> sent, int maxWor
   }
 
   //Default Summarization using only lexical chains..
-  public String summarize(String article, int maxWords)
-  {
+  public String summarize(String article, int maxWords) {
     //Build lexical Chains..
     List<Sentence> sent = dp.getSentencesFromStr(article);
-
-    List<Score>finalSc = rankSentences(article, sent, maxWords);
+    List<Score> finalSc = rankSentences(article, sent, maxWords);

Review Comment:
   > Huh, that was probably not even compiling, right?
   
   @kinow Actually, it is accepted by javac to go for sth. like this: 
   
   `Set<String>thisLooksOdd = new HashSet<>();`
   
   It compiles fine. Yet, we both agree it's totally odd to our 👀.
   
   Investigating at https://docs.oracle.com/javase/specs/jls/se11/html/index.html to find out why, for variables declared with use of generics, no space is required. Maybe, it is just a "feature" since generics were introduced in Java.



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

To unsubscribe, e-mail: dev-unsubscribe@opennlp.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [opennlp-sandbox] jzonthemtn merged pull request #99: Remove copy of PorterStemmer from summarizer component (DRY)

Posted by "jzonthemtn (via GitHub)" <gi...@apache.org>.
jzonthemtn merged PR #99:
URL: https://github.com/apache/opennlp-sandbox/pull/99


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

To unsubscribe, e-mail: dev-unsubscribe@opennlp.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [opennlp-sandbox] kinow commented on a diff in pull request #99: Remove copy of PorterStemmer from summarizer component (DRY)

Posted by "kinow (via GitHub)" <gi...@apache.org>.
kinow commented on code in PR #99:
URL: https://github.com/apache/opennlp-sandbox/pull/99#discussion_r1167968200


##########
summarizer/src/main/java/opennlp/summarization/meta/MetaSummarizer.java:
##########
@@ -115,12 +115,10 @@ public List<Score> rankSentences(String article, List<Sentence> sent, int maxWor
   }
 
   //Default Summarization using only lexical chains..
-  public String summarize(String article, int maxWords)
-  {
+  public String summarize(String article, int maxWords) {
     //Build lexical Chains..
     List<Sentence> sent = dp.getSentencesFromStr(article);
-
-    List<Score>finalSc = rankSentences(article, sent, maxWords);
+    List<Score> finalSc = rankSentences(article, sent, maxWords);

Review Comment:
   Huh, that was probably not even compiling, right? I guess this part of the sandbox is not being tested yet?



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

To unsubscribe, e-mail: dev-unsubscribe@opennlp.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [opennlp-sandbox] mawiesne commented on a diff in pull request #99: Remove copy of PorterStemmer from summarizer component (DRY)

Posted by "mawiesne (via GitHub)" <gi...@apache.org>.
mawiesne commented on code in PR #99:
URL: https://github.com/apache/opennlp-sandbox/pull/99#discussion_r1167976028


##########
summarizer/src/main/java/opennlp/summarization/meta/MetaSummarizer.java:
##########
@@ -115,12 +115,10 @@ public List<Score> rankSentences(String article, List<Sentence> sent, int maxWor
   }
 
   //Default Summarization using only lexical chains..
-  public String summarize(String article, int maxWords)
-  {
+  public String summarize(String article, int maxWords) {
     //Build lexical Chains..
     List<Sentence> sent = dp.getSentencesFromStr(article);
-
-    List<Score>finalSc = rankSentences(article, sent, maxWords);
+    List<Score> finalSc = rankSentences(article, sent, maxWords);

Review Comment:
   > Huh, that was probably not even compiling, right?
   
   @kinow Actually, it is accepted by _javac_ to go for sth. like this: 
   
   `Set<String>thisLooksOdd = new HashSet<>();`
   
   It compiles fine. Yet, we both agree it's totally odd to our 👀.
   
   Investigating at https://docs.oracle.com/javase/specs/jls/se11/html/index.html to find out why, for variables declared with use of generics, no space is required. Maybe, it is just a "feature" since generics were introduced in Java.
   
   _EDIT_:
   Could not find sth of relevance, neither in the Java Spec document (see above), nor in the BNF.



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

To unsubscribe, e-mail: dev-unsubscribe@opennlp.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org