Skip to content

Commit 65e0475

Browse files
committed
格式化代码
1 parent 3a30684 commit 65e0475

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

src/main/java/com/hankcs/hanlp/seg/Segment.java

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ else if (charTypeArray[i] == CharType.CT_LETTER)
9191
nCurType = charTypeArray[pCur - start];
9292

9393
if (nCurType == CharType.CT_CHINESE || nCurType == CharType.CT_INDEX ||
94-
nCurType == CharType.CT_DELIMITER || nCurType == CharType.CT_OTHER)
94+
nCurType == CharType.CT_DELIMITER || nCurType == CharType.CT_OTHER)
9595
{
9696
String single = String.valueOf(charArray[pCur]);
9797
if (single.length() != 0)
@@ -169,9 +169,9 @@ protected static List<AtomNode> quickAtomSegment(char[] charArray, int start, in
169169
// 浮点数识别
170170
if (preType == CharType.CT_NUM && ",,..".indexOf(charArray[offsetAtom]) != -1)
171171
{
172-
if (offsetAtom+1 < end)
172+
if (offsetAtom + 1 < end)
173173
{
174-
int nextType = CharType.get(charArray[offsetAtom+1]);
174+
int nextType = CharType.get(charArray[offsetAtom + 1]);
175175
if (nextType == CharType.CT_NUM)
176176
{
177177
continue;
@@ -191,6 +191,7 @@ protected static List<AtomNode> quickAtomSegment(char[] charArray, int start, in
191191

192192
/**
193193
* 使用用户词典合并粗分结果
194+
*
194195
* @param vertexList 粗分结果
195196
* @return 合并后的结果
196197
*/
@@ -201,8 +202,9 @@ protected static List<Vertex> combineByCustomDictionary(List<Vertex> vertexList)
201202

202203
/**
203204
* 使用用户词典合并粗分结果
205+
*
204206
* @param vertexList 粗分结果
205-
* @param dat 用户自定义词典
207+
* @param dat 用户自定义词典
206208
* @return 合并后的结果
207209
*/
208210
protected static List<Vertex> combineByCustomDictionary(List<Vertex> vertexList, DoubleArrayTrie<CoreDictionary.Attribute> dat)
@@ -280,6 +282,7 @@ protected static List<Vertex> combineByCustomDictionary(List<Vertex> vertexList,
280282

281283
/**
282284
* 使用用户词典合并粗分结果,并将用户词语收集到全词图中
285+
*
283286
* @param vertexList 粗分结果
284287
* @param wordNetAll 收集用户词语到全词图中
285288
* @return 合并后的结果
@@ -291,8 +294,9 @@ protected static List<Vertex> combineByCustomDictionary(List<Vertex> vertexList,
291294

292295
/**
293296
* 使用用户词典合并粗分结果,并将用户词语收集到全词图中
297+
*
294298
* @param vertexList 粗分结果
295-
* @param dat 用户自定义词典
299+
* @param dat 用户自定义词典
296300
* @param wordNetAll 收集用户词语到全词图中
297301
* @return 合并后的结果
298302
*/
@@ -323,10 +327,11 @@ public void hit(int begin, int end, CoreDictionary.Attribute value)
323327

324328
/**
325329
* 将连续的词语合并为一个
330+
*
326331
* @param wordNet 词图
327-
* @param start 起始下标(包含)
328-
* @param end 结束下标(不包含)
329-
* @param value 新的属性
332+
* @param start 起始下标(包含)
333+
* @param end 结束下标(不包含)
334+
* @param value 新的属性
330335
*/
331336
private static void combineWords(Vertex[] wordNet, int start, int end, CoreDictionary.Attribute value)
332337
{
@@ -401,6 +406,7 @@ static Term convert(Vertex vertex)
401406

402407
/**
403408
* 合并数字
409+
*
404410
* @param termList
405411
*/
406412
protected void mergeNumberQuantifier(List<Vertex> termList, WordNet wordNetAll, Config config)
@@ -461,10 +467,11 @@ protected void mergeNumberQuantifier(List<Vertex> termList, WordNet wordNetAll,
461467

462468
/**
463469
* 将一个词语从词网中彻底抹除
464-
* @param cur 词语
470+
*
471+
* @param cur 词语
465472
* @param wordNetAll 词网
466-
* @param line 当前扫描的行数
467-
* @param length 当前缓冲区的长度
473+
* @param line 当前扫描的行数
474+
* @param length 当前缓冲区的长度
468475
*/
469476
private static void removeFromWordNet(Vertex cur, WordNet wordNetAll, int line, int length)
470477
{
@@ -724,11 +731,11 @@ public Segment enableCustomDictionary(boolean enable)
724731

725732
/**
726733
* 是否尽可能强制使用用户词典(使用户词典的优先级尽可能高)<br>
727-
* 警告:具体实现由各子类决定,可能会破坏分词器的统计特性(例如,如果用户词典
728-
* 含有“和服”,则“商品和服务”的分词结果可能会被用户词典的高优先级影响)。
734+
* 警告:具体实现由各子类决定,可能会破坏分词器的统计特性(例如,如果用户词典
735+
* 含有“和服”,则“商品和服务”的分词结果可能会被用户词典的高优先级影响)。
736+
*
729737
* @param enable
730738
* @return 分词器本身
731-
*
732739
* @since 1.3.5
733740
*/
734741
public Segment enableCustomDictionaryForcing(boolean enable)
@@ -779,7 +786,8 @@ public Segment enableOffset(boolean enable)
779786

780787
/**
781788
* 是否启用数词和数量词识别<br>
782-
* 即[二, 十, 一] => [二十一],[十, 九, 元] => [十九元]
789+
* 即[二, 十, 一] => [二十一],[十, 九, 元] => [十九元]
790+
*
783791
* @param enable
784792
* @return
785793
*/
@@ -833,6 +841,7 @@ public void run()
833841

834842
/**
835843
* 开启多线程
844+
*
836845
* @param enable true表示开启[系统CPU核心数]个线程,false表示单线程
837846
* @return
838847
*/
@@ -845,6 +854,7 @@ public Segment enableMultithreading(boolean enable)
845854

846855
/**
847856
* 开启多线程
857+
*
848858
* @param threadNumber 线程数量
849859
* @return
850860
*/

0 commit comments

Comments
 (0)