rzo1 commented on code in PR #76:
URL: https://github.com/apache/opennlp-sandbox/pull/76#discussion_r1097444621
##########
summarizer/src/main/java/opennlp/summarization/DocProcessor.java:
##########
@@ -21,17 +21,27 @@
import opennlp.tools.stemmer.Stemmer;
-/*
+/**
* A document processor abstracts a lot of the underlying complexities of
parsing the document and
- * preparing it (e.g. stemming, stop word removal) from the summarization
algorithm. The current package
- * supports sentence extraction based algorithms. Thus extracting Sentences
from the text is the
- * first step and the basis for the algorithms.
+ * preparing it (e.g. stemming, stop word removal) from the summarization
algorithm.
+ * <p>
+ * The current package supports sentence extraction based algorithms.
+ * Thus extracting Sentences from the text is the first step and the basis for
the algorithms.
Review Comment:
`sentences`?
##########
summarizer/src/main/java/opennlp/summarization/Sentence.java:
##########
@@ -133,36 +133,36 @@ public int getWordCnt()
}
//Should add an article id to the sentence class.. For now returns true
if the ids are the same..
+ @Override
public boolean equals(Object o){
if(! (o instanceof Sentence)) return false;
-
Sentence s = (Sentence)o;
- if(s.sentId == this.sentId) return true;
- return false;
+ return s.sentId == this.sentId;
}
- static final String space=" ";
+ private static final String SPACE = " ";
+
public String stem() {
PorterStemmer stemmer = new PorterStemmer();
- StopWords sw = StopWords.getInstance();
+ StopWords sw = StopWords.getInstance();
- BreakIterator wrdItr = BreakIterator.getWordInstance(Locale.US);
+ BreakIterator wrdItr = BreakIterator.getWordInstance(Locale.US);
int wrdStrt = 0;
- StringBuffer b = new StringBuffer();
+ StringBuilder b = new StringBuilder();
wrdItr.setText(stringVal);
for(int wrdEnd = wrdItr.next(); wrdEnd != BreakIterator.DONE;
wrdStrt = wrdEnd, wrdEnd = wrdItr.next())
{
String word = this.getStringVal().substring(wrdStrt,
wrdEnd);//words[i].trim();
- word.replaceAll("\"|'","");
+ word = word.replaceAll("\"|'","");
Review Comment:
`replace` ?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]