mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
vocabularies are now also used as source for a did-you-mean computation
This commit is contained in:
parent
eaec14ecc4
commit
fa8da7f89d
|
@ -89,6 +89,10 @@ public class Autotagging {
|
|||
}
|
||||
}
|
||||
|
||||
public Set<String> allTags() {
|
||||
return this.allTags.keySet();
|
||||
}
|
||||
|
||||
public void addDictionaries(Map<String, Dictionary> dictionaries) {
|
||||
for (Map.Entry<String, Dictionary> entry: dictionaries.entrySet()) {
|
||||
Vocabulary voc = new Vocabulary(entry.getKey(), entry.getValue());
|
||||
|
|
|
@ -32,6 +32,7 @@ import java.io.InputStreamReader;
|
|||
import java.io.PrintWriter;
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
@ -111,8 +112,11 @@ public class LibraryProvider
|
|||
integrateOpenGeoDB();
|
||||
integrateGeonames();
|
||||
initAutotagging(tagPrefix);
|
||||
Set<String> allTags = new HashSet<String>() ;
|
||||
allTags.addAll(autotagging.allTags()); // we must copy this into a clone to prevent circularity
|
||||
autotagging.addLocalization(geoLoc);
|
||||
autotagging.addDictionaries(dymLib.getDictionaries());
|
||||
WordCache.learn(allTags);
|
||||
}
|
||||
|
||||
public static void integrateOpenGeoDB() {
|
||||
|
|
|
@ -220,6 +220,12 @@ public class WordCache {
|
|||
}
|
||||
}
|
||||
|
||||
public static void learn(Set<String> wordset) {
|
||||
for (String s: wordset) {
|
||||
learn(new StringBuilder(s));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* scan the input directory and load all dictionaries (again)
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user