Merge branch 'master' of ssh://git@gitorious.org/yacy/rc1.git

pull/1/head
Michael Peter Christen 13 years ago
commit 10ae6d94a1

@ -178,16 +178,13 @@ public class Autotagging {
p = line.indexOf('\t'); p = line.indexOf('\t');
} }
if (p < 0) { if (p < 0) {
this.tag2print.put(line, line); k = normalizeKey(line);
this.print2tag.put(line, line); v = normalizeWord(line);
this.tag2print.put(v, k);
this.print2tag.put(k, v);
continue vocloop; continue vocloop;
} }
k = line.substring(0, p).trim(); k = normalizeKey(line.substring(0, p));
k = k.replaceAll(" \\+", ", "); // remove symbols that are bad in a query attribute
k = k.replaceAll(" /", ", ");
k = k.replaceAll("\\+", ",");
k = k.replaceAll("/", ",");
k = k.replaceAll(" ", " ");
v = line.substring(p + 1); v = line.substring(p + 1);
tags = v.split(","); tags = v.split(",");
tagloop: for (String t: tags) { tagloop: for (String t: tags) {
@ -204,6 +201,16 @@ public class Autotagging {
} }
} }
private final String normalizeKey(String k) {
k = k.trim();
k = k.replaceAll(" \\+", ", "); // remove symbols that are bad in a query attribute
k = k.replaceAll(" /", ", ");
k = k.replaceAll("\\+", ",");
k = k.replaceAll("/", ",");
k = k.replaceAll(" ", " ");
return k;
}
public Vocabulary(String name, Localization localization) { public Vocabulary(String name, Localization localization) {
this(name); this(name);
Set<String> locNames = localization.locationNames(); Set<String> locNames = localization.locationNames();

Loading…
Cancel
Save