Mute atilika.kuromoji
This commit is contained in:
parent
24fcf4bfa8
commit
45d8204121
4 changed files with 29 additions and 54 deletions
|
@ -89,7 +89,8 @@ dependencies {
|
|||
implementation 'org.apache.commons:commons-compress:1.17'
|
||||
implementation 'com.moparisthebest:junidecode:0.1.1'
|
||||
implementation 'com.vividsolutions:jts-core:1.14.0'
|
||||
implementation 'com.atilika.kuromoji:kuromoji-ipadic:0.9.0'
|
||||
// turn off for now
|
||||
//implementation 'com.atilika.kuromoji:kuromoji-ipadic:0.9.0'
|
||||
implementation 'net.sf.kxml:kxml2:2.1.8'
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
}
|
||||
|
|
|
@ -1,59 +1,41 @@
|
|||
package net.osmand.util;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.atilika.kuromoji.ipadic.Token;
|
||||
import com.atilika.kuromoji.ipadic.Tokenizer;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.sf.junidecode.Junidecode;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
public class TransliterationHelper {
|
||||
|
||||
public final static Log LOG = PlatformUtil.getLog(TransliterationHelper.class);
|
||||
public final static String DEFAULT = "default";
|
||||
public final static String JAPAN = "Japan";
|
||||
|
||||
private static String countryName = DEFAULT;
|
||||
private static boolean japanese;
|
||||
|
||||
private static Tokenizer tokenizer;
|
||||
|
||||
private static Map<String, String> katakanaMap = new HashMap<>();
|
||||
//private static Tokenizer tokenizer;
|
||||
//private static Map<String, String> katakanaMap = new HashMap<>();
|
||||
|
||||
private TransliterationHelper() {
|
||||
}
|
||||
|
||||
public static void setCountryName(String countryName) {
|
||||
if (!countryName.equals(TransliterationHelper.countryName)) {
|
||||
switch (countryName) {
|
||||
case "Japan": {
|
||||
TransliterationHelper.countryName = JAPAN;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
TransliterationHelper.countryName = DEFAULT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
public static boolean isJapanese() {
|
||||
return japanese;
|
||||
}
|
||||
|
||||
public static String getCountryName() {
|
||||
return countryName;
|
||||
public static void setJapanese(boolean japanese) {
|
||||
TransliterationHelper.japanese = japanese;
|
||||
}
|
||||
|
||||
public static String transliterate(String text) {
|
||||
switch (countryName) {
|
||||
case DEFAULT:
|
||||
return Junidecode.unidecode(text);
|
||||
case JAPAN:
|
||||
return japanese2Romaji(text);
|
||||
if (japanese) {
|
||||
// do not transliterate japanese for now
|
||||
//return japanese2Romaji(text);
|
||||
return text;
|
||||
} else {
|
||||
return Junidecode.unidecode(text);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
/*
|
||||
private static String japanese2Romaji(String text) {
|
||||
|
||||
if (tokenizer == null) {
|
||||
|
@ -240,4 +222,5 @@ public class TransliterationHelper {
|
|||
katakanaMap.put("ピョ", "pyo");
|
||||
katakanaMap.put("ー", "-");
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -66,11 +66,12 @@ android {
|
|||
warningsAsErrors false
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
exclude '/META-INF/CONTRIBUTORS.md'
|
||||
exclude '/META-INF/LICENSE.md'
|
||||
exclude '/META-INF/NOTICE.md'
|
||||
}
|
||||
// related to kuromoji
|
||||
//packagingOptions {
|
||||
// exclude '/META-INF/CONTRIBUTORS.md'
|
||||
// exclude '/META-INF/LICENSE.md'
|
||||
// exclude '/META-INF/NOTICE.md'
|
||||
//}
|
||||
|
||||
// This is from OsmAndCore_android.aar - for some reason it's not inherited
|
||||
aaptOptions {
|
||||
|
@ -397,7 +398,8 @@ dependencies {
|
|||
implementation 'com.moparisthebest:junidecode:0.1.1'
|
||||
implementation 'org.immutables:gson:2.5.0'
|
||||
implementation 'com.vividsolutions:jts-core:1.14.0'
|
||||
implementation 'com.atilika.kuromoji:kuromoji-ipadic:0.9.0'
|
||||
// turn off for now
|
||||
//implementation 'com.atilika.kuromoji:kuromoji-ipadic:0.9.0'
|
||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||
// JS core
|
||||
implementation group: 'org.mozilla', name: 'rhino', version: '1.7.9'
|
||||
|
|
|
@ -319,13 +319,7 @@ public class MapRenderRepositories {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (containsJapanMapData) {
|
||||
TransliterationHelper.setCountryName("Japan");
|
||||
} else {
|
||||
TransliterationHelper.setCountryName("");
|
||||
}
|
||||
|
||||
|
||||
TransliterationHelper.setJapanese(containsJapanMapData);
|
||||
}
|
||||
|
||||
private void readRouteDataAsMapObjects(SearchRequest<BinaryMapDataObject> sr, BinaryMapIndexReader c,
|
||||
|
@ -552,7 +546,7 @@ public class MapRenderRepositories {
|
|||
res = new ArrayList<BinaryMapDataObject>();
|
||||
log.debug("Search failed " + c.getRegionNames(), e); //$NON-NLS-1$
|
||||
}
|
||||
if(res.size() > 0) {
|
||||
if (res.size() > 0) {
|
||||
if(basemap) {
|
||||
renderedState |= 1;
|
||||
} else {
|
||||
|
@ -600,12 +594,7 @@ public class MapRenderRepositories {
|
|||
land[0] = true;
|
||||
}
|
||||
}
|
||||
if (containsJapanMapData) {
|
||||
TransliterationHelper.setCountryName("Japan");
|
||||
} else {
|
||||
TransliterationHelper.setCountryName("");
|
||||
}
|
||||
|
||||
TransliterationHelper.setJapanese(containsJapanMapData);
|
||||
return mi;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue