merge with master

This commit is contained in:
madwasp79 2019-02-18 18:03:51 +02:00
parent 79351d932c
commit adc2ae1158
12 changed files with 77 additions and 88 deletions

View file

@ -82,18 +82,17 @@ dependencies {
testImplementation 'junit:junit:4.12'
testImplementation 'com.google.code.gson:gson:2.8.2'
testImplementation 'org.hamcrest:hamcrest-core:1.3'
implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'
implementation group: 'org.json', name: 'json', version: '20171018'
implementation 'commons-logging:commons-logging:1.2'
implementation 'org.json:json:20171018'
implementation 'it.unibo.alice.tuprolog:tuprolog:3.2.1'
implementation 'org.beanshell:bsh-core:2.0b4'
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'
// implementation 'com.atilika.kuromoji:kuromoji-ipadic:0.9.0'
implementation 'net.sf.kxml:kxml2:2.1.8'
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation files('libs/kuromoji-core-1.0-SNAPSHOT.jar')
implementation files('libs/kuromoji-ipadic-1.0-SNAPSHOT.jar')
}

Binary file not shown.

Binary file not shown.

View file

@ -152,7 +152,7 @@ public class BinaryMapAddressReaderAdapter {
switch (tag) {
case 0:
if (region.enName == null || region.enName.length() == 0) {
region.enName = region.name == null ? "" : TransliterationHelper.getInstance().transliterateText(region.name);
region.enName = region.name == null ? "" : TransliterationHelper.getInstance().transliterate(region.name);
}
return;
case OsmandOdb.OsmAndAddressIndex.NAME_FIELD_NUMBER:

View file

@ -435,7 +435,7 @@ public class BinaryMapTransportReaderAdapter {
dataObject.setEnName(stringTable.get(dataObject.getEnName(false).charAt(0)));
}
if(dataObject.getName().length() > 0 && dataObject.getName("en").length() == 0){
dataObject.setEnName(TransliterationHelper.getInstance().transliterateText(dataObject.getName()));
dataObject.setEnName(TransliterationHelper.getInstance().transliterate(dataObject.getName()));
}
if(dataObject.getOperator() != null && dataObject.getOperator().length() > 0){
dataObject.setOperator(stringTable.get(dataObject.getOperator().charAt(0)));
@ -547,7 +547,7 @@ public class BinaryMapTransportReaderAdapter {
case 0:
dataObject.setReferencesToRoutes(req.cacheTypes.toArray());
if(dataObject.getName("en").length() == 0){
dataObject.setEnName(TransliterationHelper.getInstance().transliterateText(dataObject.getName()));
dataObject.setEnName(TransliterationHelper.getInstance().transliterate(dataObject.getName()));
}
return dataObject;
case OsmandOdb.TransportStop.ROUTES_FIELD_NUMBER :
@ -611,7 +611,7 @@ public class BinaryMapTransportReaderAdapter {
switch (tag) {
case 0:
if (dataObject.getName("en").length() == 0) {
dataObject.setEnName(TransliterationHelper.getInstance().transliterateText(dataObject.getName()));
dataObject.setEnName(TransliterationHelper.getInstance().transliterate(dataObject.getName()));
}
if (x != 0 || y != 0) {
dataObject.setLocation(BinaryMapIndexReader.TRANSPORT_STOP_ZOOM, x, y);

View file

@ -261,7 +261,7 @@ public class RouteDataObject {
}
String nmDef = names.get(region.nameTypeRule);
if(transliterate && nmDef != null && nmDef.length() > 0) {
return TransliterationHelper.getInstance().transliterateText(nmDef);
return TransliterationHelper.getInstance().transliterate(nmDef);
}
return nmDef;
}
@ -295,7 +295,7 @@ public class RouteDataObject {
}
String refDefault = names.get(region.refTypeRule);
if(transliterate && refDefault != null && refDefault.length() > 0) {
return TransliterationHelper.getInstance().transliterateText(refDefault);
return TransliterationHelper.getInstance().transliterate(refDefault);
}
return refDefault;
}
@ -358,13 +358,13 @@ public class RouteDataObject {
int k = kt[i];
if(region.routeEncodingRules.size() > k) {
if(!Algorithms.isEmpty(lang) && destinationTagLangFB.equals(region.routeEncodingRules.get(k).getTag())) {
return destRef1 + ((transliterate) ? TransliterationHelper.getInstance().transliterateText(names.get(k)) : names.get(k));
return destRef1 + ((transliterate) ? TransliterationHelper.getInstance().transliterate(names.get(k)) : names.get(k));
}
if(destinationTagFB.equals(region.routeEncodingRules.get(k).getTag())) {
return destRef1 + ((transliterate) ? TransliterationHelper.getInstance().transliterateText(names.get(k)) : names.get(k));
return destRef1 + ((transliterate) ? TransliterationHelper.getInstance().transliterate(names.get(k)) : names.get(k));
}
if(!Algorithms.isEmpty(lang) && destinationTagLang.equals(region.routeEncodingRules.get(k).getTag())) {
return destRef1 + ((transliterate) ? TransliterationHelper.getInstance().transliterateText(names.get(k)) : names.get(k));
return destRef1 + ((transliterate) ? TransliterationHelper.getInstance().transliterate(names.get(k)) : names.get(k));
}
if(destinationTagDefault.equals(region.routeEncodingRules.get(k).getTag())) {
destinationDefault = names.get(k);
@ -372,7 +372,7 @@ public class RouteDataObject {
}
}
if(destinationDefault != null) {
return destRef1 + ((transliterate) ? TransliterationHelper.getInstance().transliterateText(destinationDefault) : destinationDefault);
return destRef1 + ((transliterate) ? TransliterationHelper.getInstance().transliterate(destinationDefault) : destinationDefault);
}
}
return "".equals(destRef) ? null : destRef;

View file

@ -184,7 +184,7 @@ public abstract class MapObject implements Comparable<MapObject> {
return nm;
}
if (transliterate) {
return TransliterationHelper.getInstance().transliterateText(getName());
return TransliterationHelper.getInstance().transliterate(getName());
// return Junidecode.unidecode(getName());
}
}
@ -197,7 +197,7 @@ public abstract class MapObject implements Comparable<MapObject> {
if (!Algorithms.isEmpty(enName)) {
return this.enName;
} else if (!Algorithms.isEmpty(getName()) && transliterate) {
return TransliterationHelper.getInstance().transliterateText(getName());
return TransliterationHelper.getInstance().transliterate(getName());
// return Junidecode.unidecode(getName());
}
return ""; //$NON-NLS-1$

View file

@ -19,11 +19,12 @@ public class TransliterationHelper {
private static String country = DEFAULT;
private Tokenizer tokenizer;
private static Tokenizer tokenizer;
private Map<String, String> katakanaMap = new HashMap<>();
private static Map<String, String> katakanaMap = new HashMap<>();
private TransliterationHelper(){}
private TransliterationHelper() {
}
static {
try {
@ -45,8 +46,8 @@ public class TransliterationHelper {
return country;
}
public String transliterateText(String text) {
if(tokenizer==null){
public static String transliterate(String text) {
if (tokenizer == null) {
tokenizer = new Tokenizer();
}
switch (country) {
@ -58,12 +59,11 @@ public class TransliterationHelper {
return text;
}
private String japanese2Romaji(String input) {
private static String japanese2Romaji(String text) {
boolean capitalizeWords = true;
List<Token> tokens = tokenizer.tokenize(input);
List<Token> tokens = tokenizer.tokenize(text);
StringBuilder builder = new StringBuilder();
if (katakanaMap.isEmpty()) {
@ -94,8 +94,7 @@ public class TransliterationHelper {
builder.append(romaji.substring(1));
} else {
if (token.getSurface()
.equals(token.getPronunciation()))
{
.equals(token.getPronunciation())) {
romaji = romaji.toUpperCase();
}
builder.append(romaji);
@ -107,7 +106,7 @@ public class TransliterationHelper {
return builder.toString();
}
private String convertKanaToRomaji(String s) {
private static String convertKanaToRomaji(String s) {
StringBuilder t = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
if (i <= s.length() - 2) {
@ -132,7 +131,7 @@ public class TransliterationHelper {
return t.toString();
}
private void initKanaMap(){
private static void initKanaMap() {
katakanaMap.put("", "a");
katakanaMap.put("", "i");
katakanaMap.put("", "u");

View file

@ -388,8 +388,7 @@ dependencies {
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation fileTree(include: ['gnu-trove-osmand.jar', 'icu4j-49_1_patched.jar'], dir: 'libs')
implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'
implementation 'commons-logging:commons-logging:1.2'
implementation 'commons-codec:commons-codec:1.11'
implementation 'it.unibo.alice.tuprolog:tuprolog:3.2.1'
implementation 'org.beanshell:bsh-core:2.0b4'
@ -397,34 +396,26 @@ 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.squareup.picasso:picasso:2.71828'
// JS core
implementation group: 'org.mozilla', name: 'rhino', version: '1.7.9'
// size restrictions
// implementation 'com.ibm.icu:icu4j:50.1'
// implementation 'net.sf.trove4j:trove4j:3.0.3'
implementation 'org.mozilla:rhino:1.7.9'
// size restrictions
// implementation 'com.ibm.icu:icu4j:50.1'
// implementation 'net.sf.trove4j:trove4j:3.0.3'
qtcoreImplementation fileTree(include: ['QtAndroid.jar', 'QtAndroidBearer.jar'], dir: 'libs')
qtcoredebugImplementation fileTree(include: ['QtAndroid.jar', 'QtAndroidBearer.jar'], dir: 'libs')
legacyImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@jar"
qtcoredebugImplementation "net.osmand:OsmAndCore_androidNativeDebug:0.1-SNAPSHOT@aar"
qtcoredebugImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
qtcoreImplementation "net.osmand:OsmAndCore_androidNativeRelease:0.1-SNAPSHOT@aar"
qtcoreImplementation "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
implementation ("com.getkeepsafe.taptargetview:taptargetview:1.12.0"){
implementation('com.getkeepsafe.taptargetview:taptargetview:1.12.0') {
exclude group: 'com.android.support'
}
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.1'
implementation ("com.github.HITGIF:TextFieldBoxes:1.3.5"){
implementation('com.github.HITGIF:TextFieldBoxes:1.3.5') {
exclude group: 'com.android.support'
}
implementation 'com.atilika.kuromoji:kuromoji-ipadic:0.9.0'
}
if(analytics) {

View file

@ -137,7 +137,7 @@ public class NominatimPoiFilter extends PoiUIFilter {
a.setId(Long.parseLong(parser.getAttributeValue("", "place_id"))); //$NON-NLS-1$ //$NON-NLS-2$
String name = parser.getAttributeValue("", "display_name"); //$NON-NLS-1$//$NON-NLS-2$
a.setName(name);
a.setEnName(TransliterationHelper.getInstance().transliterateText(getName()));
a.setEnName(TransliterationHelper.getInstance().transliterate(getName()));
a.setSubType(parser.getAttributeValue("", "type")); //$NON-NLS-1$//$NON-NLS-2$
PoiType pt = poiTypes.getPoiTypeByKey(a.getSubType());
a.setType(pt != null ? pt.getCategory() : poiTypes.getOtherPoiCategory());
@ -153,7 +153,7 @@ public class NominatimPoiFilter extends PoiUIFilter {
String name = parser.getText();
if (name != null) {
a.setName(name);
a.setEnName(TransliterationHelper.getInstance().transliterateText(getName()));
a.setEnName(TransliterationHelper.getInstance().transliterate(getName()));
}
}
}

View file

@ -241,7 +241,7 @@ public class TextRenderer {
TextDrawInfo text = rc.textToDraw.get(i);
if (text.text != null && text.text.length() > 0) {
if (preferredLocale.length() > 0) {
text.text = TransliterationHelper.getInstance().transliterateText(text.text);
text.text = TransliterationHelper.getInstance().transliterate(text.text);
}

View file

@ -6,7 +6,7 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit