|
@@ -73,7 +73,7 @@ public class NNDataSetImpl extends NNDataSet {
|
|
int[] ids = new int[max_len];
|
|
int[] ids = new int[max_len];
|
|
char ch = '1';
|
|
char ch = '1';
|
|
Integer id = null;
|
|
Integer id = null;
|
|
- for (int i = 0; i < sentence.length(); i++) {
|
|
|
|
|
|
+ for (int i = 0; i < sentence.length() && i < max_len; i++) { // 不超过最大长度
|
|
ch = sentence.charAt(i);
|
|
ch = sentence.charAt(i);
|
|
id = this.CHAR2ID_DICT.get(String.valueOf(ch));
|
|
id = this.CHAR2ID_DICT.get(String.valueOf(ch));
|
|
if (id == null) {
|
|
if (id == null) {
|