@@ -274,7 +274,7 @@ protected static List<Vertex> combineByCustomDictionary(List<Vertex> vertexList,
274
274
vertexList .toArray (wordNet );
275
275
// DAT合并
276
276
DoubleArrayTrie <CoreDictionary .Attribute > dat = CustomDictionary .dat ;
277
- for (int i = 0 ; i < wordNet .length ; ++i )
277
+ for (int i = 0 , line = 0 ; i < wordNet .length ; ++i )
278
278
{
279
279
int state = 1 ;
280
280
state = dat .transition (wordNet [i ].realWord , state );
@@ -297,15 +297,24 @@ protected static List<Vertex> combineByCustomDictionary(List<Vertex> vertexList,
297
297
if (value != null )
298
298
{
299
299
combineWords (wordNet , i , end , value );
300
- wordNetAll .add (i , wordNet [i ]);
300
+ wordNetAll .add (line , wordNet [i ]);
301
+ line += wordNet [i ].realWord .length ();
301
302
i = end - 1 ;
302
303
}
304
+ else
305
+ {
306
+ line += wordNet [i ].realWord .length ();
307
+ }
308
+ }
309
+ else
310
+ {
311
+ line += wordNet [i ].realWord .length ();
303
312
}
304
313
}
305
314
// BinTrie合并
306
315
if (CustomDictionary .trie != null )
307
316
{
308
- for (int i = 0 ; i < wordNet .length ; ++i )
317
+ for (int i = 0 , line = 0 ; i < wordNet .length ; ++i )
309
318
{
310
319
if (wordNet [i ] == null ) continue ;
311
320
BaseNode <CoreDictionary .Attribute > state = CustomDictionary .trie .transition (wordNet [i ].realWord .toCharArray (), 0 );
@@ -328,9 +337,18 @@ protected static List<Vertex> combineByCustomDictionary(List<Vertex> vertexList,
328
337
if (value != null )
329
338
{
330
339
combineWords (wordNet , i , end , value );
331
- wordNetAll .add (i , wordNet [i ]);
340
+ wordNetAll .add (line , wordNet [i ]);
341
+ line += wordNet [i ].realWord .length ();
332
342
i = end - 1 ;
333
343
}
344
+ else
345
+ {
346
+ line += wordNet [i ].realWord .length ();
347
+ }
348
+ }
349
+ else
350
+ {
351
+ line += wordNet [i ].realWord .length ();
334
352
}
335
353
}
336
354
}
0 commit comments