rzo1 commented on code in PR #458:
URL: https://github.com/apache/opennlp/pull/458#discussion_r1049705186
##########
opennlp-tools/src/main/java/opennlp/tools/parser/ParserModel.java:
##########
@@ -367,4 +367,27 @@ else if (ParserType.TREEINSERT.equals(modelType)) {
throw new InvalidFormatException("Missing the head rules!");
}
}
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(artifactMap.get("manifest.properties"),
+ artifactMap.get(PARSER_TAGGER_MODEL_ENTRY_NAME));
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+
+ if (obj instanceof ParserModel) {
+ ParserModel model = (ParserModel) obj;
+ Map<String, Object> artifactMapToCheck = model.artifactMap;
+ AbstractModel abstractModel = (AbstractModel)
artifactMapToCheck.get(BUILD_MODEL_ENTRY_NAME);
+
+ return
artifactMap.get("manifest.properties").equals(artifactMapToCheck.get("manifest.properties"))
&&
Review Comment:
see above
##########
opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenizerModel.java:
##########
@@ -162,4 +163,26 @@ public Dictionary getAbbreviations() {
public boolean useAlphaNumericOptimization() {
return getFactory() != null && getFactory().isUseAlphaNumericOptmization();
}
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(artifactMap.get("manifest.properties"),
artifactMap.get(TOKENIZER_MODEL_ENTRY));
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+
+ if (obj instanceof TokenizerModel) {
+ TokenizerModel model = (TokenizerModel) obj;
+ Map<String, Object> artifactMapToCheck = model.artifactMap;
+ AbstractModel abstractModel = (AbstractModel)
artifactMapToCheck.get(TOKENIZER_MODEL_ENTRY);
+
+ return
artifactMap.get("manifest.properties").equals(artifactMapToCheck.get("manifest.properties"))
&&
Review Comment:
see above
##########
opennlp-tools/src/main/java/opennlp/tools/parser/ParserModel.java:
##########
@@ -367,4 +367,27 @@ else if (ParserType.TREEINSERT.equals(modelType)) {
throw new InvalidFormatException("Missing the head rules!");
}
}
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(artifactMap.get("manifest.properties"),
Review Comment:
Can we use ` MANIFEST_ENTRY` from `BaseModel` ?
##########
opennlp-tools/src/main/java/opennlp/tools/tokenize/TokenizerModel.java:
##########
@@ -162,4 +163,26 @@ public Dictionary getAbbreviations() {
public boolean useAlphaNumericOptimization() {
return getFactory() != null && getFactory().isUseAlphaNumericOptmization();
}
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(artifactMap.get("manifest.properties"),
artifactMap.get(TOKENIZER_MODEL_ENTRY));
Review Comment:
see above
--
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]