Skip to content

Commit bad40a5

Browse files
committed
Enabled shortlist on bergamot for testing, plus minor other changes
1 parent 353a740 commit bad40a5

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

app/src/main/cpp/src/BergamotTranslator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void initializeService() {
3737

3838
if (global_service == nullptr) {
3939
BlockingService::Config blockingConfig;
40-
blockingConfig.cacheSize = 256;
40+
blockingConfig.cacheSize = 0; //todo: change it back to 256 in release
4141
blockingConfig.logger.level = "off";
4242
global_service = std::make_unique<BlockingService>(blockingConfig);
4343
}

app/src/main/java/nie/translator/rtranslator/voice_translation/_text_translation/TranslationFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public void onClick(View view) {
239239
String text = inputText.getText().toString();
240240

241241
if(text.length() <= 0){ //test code
242-
text = "Also unlike 2014, there aren’t nearly as many loopholes. You can’t just buy a 150-watt incandescent or a three-way bulb, the ban covers any normal bulb that generates less than 45 lumens per watt, which pretty much rules out both incandescent and halogen tech in their entirety.";
242+
text = "Also unlike 2014, there aren’t nearly as many loopholes. You can’t just buy a 150-watt incandescent or a three-way bulb the ban covers any normal bulb that generates less than 45 lumens per watt, which pretty much rules out both incandescent and halogen tech in their entirety.";
243243
inputText.setText(text);
244244
}
245245

app/src/main/java/nie/translator/rtranslator/voice_translation/neural_networks/translation/BergamotTranslator.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ private static String modelConfigGeneration(Context context, String lang, ModelT
8181
File model = null;
8282
File srcVocab = null;
8383
File trgVocab = null;
84+
File lexShort = null;
8485
if(modelFiles == null) throw new Exception("No models files found");
8586
for (File file : modelFiles) {
8687
if(file.getName().contains("model")){
@@ -100,15 +101,22 @@ private static String modelConfigGeneration(Context context, String lang, ModelT
100101
trgVocab = file;
101102
continue;
102103
}
104+
if(file.getName().contains("lex.")){
105+
lexShort = file;
106+
continue;
107+
}
103108
}
104-
if (model != null && (srcVocab != null && trgVocab != null)) {
109+
if (model != null && lexShort != null && (srcVocab != null && trgVocab != null)) {
105110
return "models:\n" +
106111
" - "+model.getPath()+"\n" +
107112
"vocabs:\n" +
108-
" - "+srcVocab.getAbsolutePath()+"\n" +
109-
" - "+trgVocab.getAbsolutePath()+"\n" +
110-
"beam-size: 4\n" +
111-
"normalize: 0.7\n" +
113+
" - "+srcVocab.getPath()+"\n" +
114+
" - "+trgVocab.getPath()+"\n" +
115+
"shortlist: \n" +
116+
" - "+lexShort.getPath()+"\n" +
117+
" - false\n" +
118+
"beam-size: 1\n" +
119+
"normalize: 1.0\n" +
112120
"word-penalty: 0\n" +
113121
"max-length-break: 256\n" +
114122
"max-length-factor: 3.0\n" +

0 commit comments

Comments
 (0)