Merge pull request #69 from Stepanov-Sergey/master

to add Russian synonyms
pull/71/head
Burkhard 8 years ago committed by GitHub
commit 4b6f41375a

@ -231,6 +231,16 @@
<dt>Action</dt>
<dd>#(syn1Status)#<input type="submit" name="syn1Activate" class="btn btn-sm btn-primary" value="Activate" />::<input type="submit" name="syn1Deactivate" class="btn btn-sm btn-primary" value="Deactivate" />#(/syn1Status)#</dd>
</dl>
<h4>Russian Thesaurus</h4>
<p>The data was converted to the YaCy synonym file format and part of the YaCy distribution.</p>
<dl>
<dt><label>Status</label></dt>
<dd>#(syn2Status)#<div class="info">Deactivated</div>::<div class="commit">Activated</div>#(/syn2Status)#</dd>
<dt>Action</dt>
<dd>#(syn2Status)#<input type="submit" name="syn2Activate" class="btn btn-sm btn-primary" value="Activate" />::<input type="submit" name="syn2Deactivate" class="btn btn-sm btn-primary" value="Deactivate" />#(/syn2Status)#</dd>
</dl>
</fieldset>
</form>
#%env/templates/footer.template%#

@ -49,6 +49,8 @@ public class DictionaryLoader_p {
final File synonym_de_production = new File(synonyms_path, synonym_de_default.getName());
final File synonym_en_default = new File(new File(new File(sb.appPath, "addon"), "synonyms"), "mobythesaurus_en_yacy");
final File synonym_en_production = new File(synonyms_path, synonym_en_default.getName());
final File synonym_ru_default = new File(new File(new File(sb.appPath, "addon"), "synonyms"), "thesaurus_ru_yacy");
final File synonym_ru_production = new File(synonyms_path, synonym_ru_default.getName());
/*
* distinguish the following cases:
* - dictionary file was not loaded -> actions: load the file
@ -70,7 +72,7 @@ public class DictionaryLoader_p {
// check here only if there is no possibility synonym libraries have been activated/deactivated
prop.put("syn0Status", synonym_de_production.exists() ? 1 : 0);
prop.put("syn1Status", synonym_en_production.exists() ? 1 : 0);
prop.put("syn2Status", synonym_ru_production.exists() ? 1 : 0);
return prop;
}
@ -323,10 +325,24 @@ public class DictionaryLoader_p {
SynonymLibrary.init(synonyms_path);
}
if (post.containsKey("syn0Deactivate")) {
synonym_de_production.delete();
SynonymLibrary.init(synonyms_path);
}
if (post.containsKey("syn2Activate")) {
try {
FileUtils.copy(new FileInputStream(synonym_ru_default), synonym_ru_production);
} catch (IOException e) {
ConcurrentLog.logException(e);
}
SynonymLibrary.init(synonyms_path);
}
if (post != null) {
// check here if there is a possibility synonym libraries have been activated/deactivated
prop.put("syn0Status", synonym_de_production.exists() ? 1 : 0);
prop.put("syn1Status", synonym_en_production.exists() ? 1 : 0);
prop.put("syn2Status", synonym_ru_production.exists() ? 1 : 0);
}
// check status again

Loading…
Cancel
Save