rzo1 commented on code in PR #59:
URL: https://github.com/apache/opennlp-sandbox/pull/59#discussion_r1082216933
##
opennlp-wsd/pom.xml:
##
@@ -25,20 +25,20 @@
org.apache
apache
- 13
+ 18
Review Comment:
Can we go for `29` ? We can update it in `opennlp` as well (mostly build
support, etc.)
##
opennlp-wsd/src/main/java/opennlp/tools/disambiguator/WSDHelper.java:
##
@@ -480,14 +482,10 @@ public static HashMap
getEnglishWords(String dict) {
*/
public static POS getPOS(String posTag) {
-ArrayList adjective = new ArrayList(Arrays.asList("JJ",
-"JJR", "JJS"));
-ArrayList adverb = new ArrayList(Arrays.asList("RB", "RBR",
-"RBS"));
-ArrayList noun = new ArrayList(Arrays.asList("NN", "NNS",
-"NNP", "NNPS"));
-ArrayList verb = new ArrayList(Arrays.asList("VB", "VBD",
-"VBG", "VBN", "VBP", "VBZ"));
+List adjective = new ArrayList<>(Arrays.asList("JJ", "JJR",
"JJS"));
Review Comment:
The `new ArrayList()` calls are not needed.
##
opennlp-wsd/src/main/java/opennlp/tools/disambiguator/WSDHelper.java:
##
@@ -631,7 +629,7 @@ public static ArrayList
getAllRelevantWords(String[] sentence) {
public static ArrayList StemWordWithWordNet(WordPOS wordToStem) {
if (wordToStem == null)
return null;
-ArrayList stems = new ArrayList();
+ArrayList stems = new ArrayList<>();
Review Comment:
List?
##
opennlp-wsd/src/main/java/opennlp/tools/disambiguator/WSDHelper.java:
##
@@ -606,7 +604,7 @@ public static boolean areStringArraysEqual(String[] array1,
String[] array2) {
public static ArrayList getAllRelevantWords(String[] sentence) {
-ArrayList relevantWords = new ArrayList();
+ArrayList relevantWords = new ArrayList<>();
Review Comment:
List?
##
opennlp-wsd/src/main/java/opennlp/tools/disambiguator/datareader/SensevalReader.java:
##
@@ -218,9 +240,9 @@ public ArrayList getSensevalData(String wordTag)
{
String textAfter = nChild.getChildNodes().item(2)
.getTextContent();
- ArrayList textBeforeTokenzed = new
ArrayList(
+ ArrayList textBeforeTokenzed = new ArrayList<>(
Review Comment:
No need for `new` Operator, if we use `List` interface
##
opennlp-wsd/src/main/java/opennlp/tools/disambiguator/WSDHelper.java:
##
@@ -68,11 +72,11 @@ public class WSDHelper {
"RBR", "RBS", "VB", "VBD", "VBG", "VBN", "VBP", "VBZ" };
// List of Negation Words
- public static ArrayList negationWords = new ArrayList(
+ public static ArrayList negationWords = new ArrayList<>(
Review Comment:
There is a switch from `HashMap` to `Map` -> also switch from `ArrayList` to
`List` ?
##
opennlp-wsd/src/main/java/opennlp/tools/disambiguator/datareader/SemcorReaderExtended.java:
##
@@ -200,7 +202,7 @@ private ArrayList readFile(String file) {
*/
private ArrayList getSemcorOneFileData(String file, String
wordTag) {
-ArrayList setInstances = new ArrayList();
+ArrayList setInstances = new ArrayList<>();
Review Comment:
List?
--
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-unsubscr...@opennlp.apache.org
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org