Skip to content

Commit 487a897

Browse files
committed
release branch 1.0.2
1 parent 55f6033 commit 487a897

35 files changed

+440
-931
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515
| 类型 | 变化 | 时间 | 备注 |
1616
|:---|:---|:---|:---|
1717
| Fixed | 修正原来包的依赖 | 2018-06-22 11:03:46 | |
18+
| Simple | 简化实现方式 | 2018-06-22 15:27:54 | |

README-ENGLISH.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ supporting character-level conversion, phrase-level conversion for java.
3939
<dependency>
4040
<groupId>com.github.houbb</groupId>
4141
<artifactId>opencc4j</artifactId>
42-
<version>1.0.0</version>
42+
<version>1.0.2</version>
4343
</dependency>
4444
```
4545

@@ -69,11 +69,6 @@ the result is:
6969
生命不息,奮鬥不止
7070
```
7171

72-
## Other support
73-
74-
You can also use `StringBuilder` for argument when you use the two methods.
75-
76-
More details,you can see [ZhConverterUtilTest.java](src/test/java/com/github/houbb/opencc4j/util/ZhConverterUtilTest.java)
7772

7873

7974
# Thanks

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,18 @@ String result = ZhConverterUtil.convertToTraditional(original);
7171

7272
## 其他支持
7373

74-
上述 2 个方法,都支持 `StringBuilder` 作为入参。
75-
76-
更多详情,可参见测试用例 [ZhConverterUtilTest.java](src/test/java/com/github/houbb/opencc4j/util/ZhConverterUtilTest.java)
74+
上述两个方法都默认使用的花瓣分词,都有第二个参数,是否启用花瓣分词。
75+
如果不启用,则默认使用普通的一个 char 作为一个转换的对象。(不建议,唯一的优势性能好一点,但是准确性不行)
7776

77+
```java
78+
/**
79+
* 转换为简体
80+
* @param original 原始内容
81+
* @param huabanSegment 是否花瓣分词
82+
* @return 转换后的内容
83+
*/
84+
public static String convertToSimple(String original, boolean huabanSegment);
85+
```
7886

7987
# 技术鸣谢
8088

release_rm.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
echo "============================= RELEASE START..."
3+
4+
## 版本号信息(需要手动指定)
5+
oldVersion="1.0.2"
6+
newVersion="1.0.2"
7+
projectName="metadata"
8+
9+
# 删除分支
10+
oldBranchName="release_"${oldVersion}
11+
git branch -d ${oldBranchName}
12+
git push origin --delete ${oldBranchName}
13+
14+
echo "1. Branch remove success..."
15+
16+
# 拉取新的分支
17+
newBranchName="release_"${newVersion}
18+
git branch ${newBranchName}
19+
git checkout ${newBranchName}
20+
git push --set-upstream origin ${newBranchName}
21+
22+
echo "2. NEW BRANCH DONE."
23+
24+
# 修改新分支的版本号
25+
## snapshot 版本号
26+
snapshot_new_version=${newVersion}"-SNAPSHOT"
27+
mvn versions:set -DgroupId=com.github.houbb -DartifactId=${projectName} -DoldVersion=${release_version} -DnewVersion=${snapshot_new_version}
28+
mvn -N versions:update-child-modules
29+
mvn versions:commit
30+
31+
git add .
32+
git commit -m "modify branch ${release_version} TO ${snapshot_new_version}"
33+
git push
34+
git status
35+
echo "3. MODIFY ${release_version} TO ${snapshot_new_version} DONE."
36+
37+
echo "============================= BRANCH RE-CREATE END..."
38+
39+
echo "============================= BRANCH LIST ============================="
40+
git branch -a
41+
42+
# 使用方式:
43+
# 注意:本脚本用于删除分支,谨慎使用!
44+
# 1. 赋值权限: chmod +x ./release_rm.sh
45+
# 2. 执行: ./release_rm.sh
46+
# Last Update Time: 2018-06-21 11:10:42
47+
# Author: houbb
48+
49+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.github.houbb.opencc4j.core;
2+
3+
import java.util.List;
4+
5+
/**
6+
* <p> </p>
7+
*
8+
* <pre> Created: 2018/6/22 下午2:41 </pre>
9+
* <pre> Project: opencc4j </pre>
10+
*
11+
* @author houbinbin
12+
* @version 1.0
13+
* @since JDK 1.7
14+
*/
15+
public interface Segment {
16+
17+
/**
18+
* 分词
19+
* @param original 原始信息
20+
* @return 分词后的列表
21+
*/
22+
List<String> seg(final String original);
23+
24+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.github.houbb.opencc4j.core;
2+
3+
/**
4+
* <p> </p>
5+
*
6+
* <pre> Created: 2018/6/22 下午2:42 </pre>
7+
* <pre> Project: opencc4j </pre>
8+
*
9+
* @author houbinbin
10+
* @version 1.0
11+
* @since JDK 1.7
12+
*/
13+
public interface ZhConvert {
14+
15+
/**
16+
* 对中文进行转化
17+
* @param original 原始信息
18+
* @return 转换后的信息
19+
*/
20+
String convert(final String original);
21+
22+
}

src/main/java/com/github/houbb/opencc4j/core/ZhConverter.java

Lines changed: 0 additions & 55 deletions
This file was deleted.

src/main/java/com/github/houbb/opencc4j/core/impl/AbstractZhConverter.java

Lines changed: 0 additions & 85 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.github.houbb.opencc4j.core.impl;
2+
3+
import com.github.houbb.opencc4j.core.Segment;
4+
import com.github.houbb.paradise.common.util.StringUtil;
5+
6+
import java.util.ArrayList;
7+
import java.util.Collections;
8+
import java.util.List;
9+
10+
/**
11+
* <p> 简单的转化为 char 列表 </p>
12+
*
13+
* <pre> Created: 2018/6/22 下午2:43 </pre>
14+
* <pre> Project: opencc4j </pre>
15+
*
16+
* @author houbinbin
17+
* @version 1.0
18+
* @since JDK 1.7
19+
*/
20+
public class CharSegment implements Segment {
21+
22+
@Override
23+
public List<String> seg(String original) {
24+
if(StringUtil.isEmpty(original)) {
25+
return Collections.emptyList();
26+
}
27+
28+
char[] chars = original.toCharArray();
29+
List<String> stringList = new ArrayList<>();
30+
for(char c : chars) {
31+
stringList.add(String.valueOf(c));
32+
}
33+
return stringList;
34+
}
35+
36+
}

0 commit comments

Comments
 (0)