danmuzi commented on a change in pull request #767: LUCENE-8904: enhance Nori
DictionaryBuilder tool
URL: https://github.com/apache/lucene-solr/pull/767#discussion_r301228809
##########
File path:
lucene/analysis/nori/src/tools/java/org/apache/lucene/analysis/ko/util/BinaryDictionaryWriter.java
##########
@@ -137,14 +139,17 @@ public int put(String[] entry) {
flags |= BinaryDictionary.HAS_READING;
}
- assert leftId < 8192; // there are still unused bits
- assert posType.ordinal() < 4;
+ if (leftId >= ID_LIMIT) {
+ throw new IllegalArgumentException("leftId >= " + ID_LIMIT + ": " +
leftId);
+ }
+ if (posType.ordinal() >= 4) {
+ throw new IllegalArgumentException("posType.ordinal() >= " + 4 + ": " +
posType.ordinal());
+ }
buffer.putShort((short)(leftId << 2 | posType.ordinal()));
buffer.putShort((short) (rightId << 2 | flags));
buffer.putShort(wordCost);
if (posType == POS.Type.MORPHEME) {
- assert leftPOS == rightPOS;
Review comment:
OK :)
I understand what you mean and I'll keep it.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]