-
Notifications
You must be signed in to change notification settings - Fork 549
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
1,161 additions
and
1,583 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 28 additions & 9 deletions
37
src/main/java/org/elasticsearch/analysis/PinyinConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,38 @@ | ||
package org.elasticsearch.analysis; | ||
|
||
import org.elasticsearch.common.settings.Settings; | ||
|
||
/** | ||
* Created by medcl on 15/11/26. | ||
*/ | ||
public class PinyinConfig { | ||
|
||
public enum Mode{ | ||
onlyFirstLetter(1), | ||
fullPinyin(2), | ||
fullPinyinWithSpace(3), | ||
supportPolyphony(4); | ||
public boolean lowercase=true; | ||
public boolean trimWhitespace=true; | ||
public boolean keepNoneChinese=true; | ||
public boolean keepNoneChineseInFirstLetter =true; | ||
public boolean keepOriginal=false; | ||
public boolean keepFirstLetter=true; | ||
public boolean keepSeparateFirstLetter=false; | ||
public boolean keepNoneChineseTogether=true; | ||
public boolean noneChinesePinyinTokenize =true; | ||
public int LimitFirstLetterLength=16; | ||
public boolean keepFullPinyin=true; | ||
public boolean removeDuplicateTerm=false; | ||
|
||
private final int value; | ||
Mode(int i) { | ||
value=i; | ||
} | ||
public PinyinConfig() {} | ||
public PinyinConfig(Settings settings) { | ||
this.keepFirstLetter=settings.getAsBoolean("keep_first_letter",true); | ||
this.keepSeparateFirstLetter=settings.getAsBoolean("keep_separate_first_letter",false); | ||
this.keepFullPinyin=settings.getAsBoolean("keep_full_pinyin", true); | ||
this.keepNoneChinese=settings.getAsBoolean("keep_none_chinese",true); | ||
this.keepNoneChineseTogether=settings.getAsBoolean("keep_none_chinese_together",true); | ||
this.noneChinesePinyinTokenize =settings.getAsBoolean("none_chinese_pinyin_tokenize",true); | ||
this.keepOriginal=settings.getAsBoolean("keep_original", false); | ||
this.LimitFirstLetterLength=settings.getAsInt("limit_first_letter_length", 16); | ||
this.lowercase=settings.getAsBoolean("lowercase", true); | ||
this.trimWhitespace=settings.getAsBoolean("trim_whitespace", true); | ||
this.keepNoneChineseInFirstLetter =settings.getAsBoolean("keep_none_chinese_in_first_letter", true); | ||
this.removeDuplicateTerm =settings.getAsBoolean("remove_duplicated_term", false); | ||
} | ||
} |
Oops, something went wrong.