replace with CommonPattern.SPACE for split

pull/1/head
Michael Peter Christen 10 years ago
parent de3e373913
commit 68c605d637

@ -39,6 +39,7 @@ import net.yacy.cora.document.encoding.UTF8;
import net.yacy.cora.protocol.Domains;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.util.CommonPattern;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.data.BlogBoard;
import net.yacy.data.BlogBoardComments;
@ -290,7 +291,7 @@ public class BlogComments {
// get the sendmail configuration
final String sendMailStr = sb.getConfig("msgForwardingCmd","/usr/bin/sendmail")+" "+sendMailTo;
final String[] sendMail = sendMailStr.trim().split(" ");
final String[] sendMail = CommonPattern.SPACE.split(sendMailStr.trim());
// build the message text
final StringBuilder emailTxt = new StringBuilder();

@ -452,7 +452,7 @@ public class ViewFile {
words = words.substring(1, words.length() - 1);
}
words = UTF8.decodeURL(words);
if (words.indexOf(' ',0) >= 0) return words.split(" ");
if (words.indexOf(' ',0) >= 0) return CommonPattern.SPACE.split(words);
if (words.indexOf(',',0) >= 0) return CommonPattern.COMMA.split(words);
if (words.indexOf('+',0) >= 0) return words.split("\\+");
w = new String[1];

@ -164,7 +164,7 @@ public class Vocabulary_p {
t = t.replaceAll("_", " ").replaceAll("\"", " ").replaceAll("'", " ").replaceAll(",", " ").replaceAll(" ", " ").trim();
if (t.isEmpty()) continue;
if (discoverFromTitleSplitted) {
String[] ts = t.split(" ");
String[] ts = CommonPattern.SPACE.split(t);
for (String s: ts) {
if (s.isEmpty()) continue;
if (s.endsWith(".jpg") || s.endsWith(".gif")) continue;

@ -187,7 +187,7 @@ public void processCitation(String host, HashMap props) {
}
public HashMap parseProps(String s) {
String[] l = s.split(" ");
String[] l = CommonPattern.SPACE.split(s);
HashMap map = new HashMap();
int p;
String z;

@ -39,6 +39,7 @@ import net.yacy.cora.document.encoding.UTF8;
import net.yacy.cora.protocol.Domains;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.util.CommonPattern;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.data.MessageBoard;
import net.yacy.peers.Network;
@ -181,7 +182,7 @@ public final class message {
// get the sendmail configuration
final String sendMailStr = sb.getConfig("msgForwardingCmd","/usr/bin/sendmail")+" "+sendMailTo;
final String[] sendMail = sendMailStr.trim().split(" ");
final String[] sendMail = CommonPattern.SPACE.split(sendMailStr.trim());
// building the message text
final StringBuilder emailTxt = new StringBuilder();

@ -30,6 +30,7 @@ import net.yacy.cora.protocol.ClientIdentification;
import net.yacy.cora.protocol.Domains;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.util.CommonPattern;
import net.yacy.document.LibraryProvider;
import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
@ -69,7 +70,7 @@ public class yacysearch_location {
int placemarkCounter = 0;
if (query.length() > 0 && search_query) {
final Set<GeoLocation> locations = LibraryProvider.geoLoc.find(query, true);
for (final String qp: query.split(" ")) {
for (final String qp: CommonPattern.SPACE.split(query)) {
locations.addAll(LibraryProvider.geoLoc.find(qp, true));
}
String ip = sb.peers.mySeed().getIP();

@ -20,6 +20,7 @@ import org.apache.solr.common.SolrException;
import net.yacy.cora.sorting.ClusteredScoreMap;
import net.yacy.cora.sorting.OrderedScoreMap;
import net.yacy.cora.sorting.ReversibleScoreMap;
import net.yacy.cora.util.CommonPattern;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.cora.util.StringBuilderComparator;
import net.yacy.document.LibraryProvider;
@ -246,7 +247,7 @@ public class DidYouMean {
if (sp >= 0) s = s.substring(0, sp);
sp = s.indexOf("<b>");
if (sp >= 0) s = s.substring(0, sp).trim();
String[] sx = s.split(" ");
String[] sx = CommonPattern.SPACE.split(s);
StringBuilder sb = new StringBuilder(s.length());
for (String x: sx) if (x.length() > 1 && sb.length() < 28) sb.append(x).append(' '); else break;
s = sb.toString().trim();

@ -14,6 +14,7 @@ import net.yacy.cora.document.id.DigestURL;
import net.yacy.cora.document.id.MultiProtocolURL;
import net.yacy.cora.federate.yacy.CacheStrategy;
import net.yacy.cora.protocol.ClientIdentification;
import net.yacy.cora.util.CommonPattern;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.crawler.retrieval.Response;
import net.yacy.document.Condenser;
@ -105,7 +106,7 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandle
score = 10;
final String phrase = iter.next();
if(phrases.get(phrase).size() > 3 && phrases.get(phrase).size() < 10) {
score = phrases.get(phrase).size() * phrase.split(" ").length * 20;
score = phrases.get(phrase).size() * CommonPattern.SPACE.split(phrase).length * 20;
}
if(isDigitSpace(phrase)) {
score = 10;

@ -687,7 +687,7 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
imgprots.add(protocol);
imgstubs[i] = uri.toString().substring(protocol.length() + 3);
imgalts[i] = ie.alt();
for (String it: uri.toTokens().split(" ")) images_text_map.add(it);
for (String it: CommonPattern.SPACE.split(uri.toTokens())) images_text_map.add(it);
if (ie.alt() != null && ie.alt().length() > 0) {
SentenceReader sr = new SentenceReader(ie.alt());
while (sr.hasNext()) images_text_map.add(sr.next().toString());
@ -906,7 +906,7 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seri
if (content == null || content.length() == 0) {
content = tokens;
} else {
String[] t = tokens.split(" ");
String[] t = CommonPattern.SPACE.split(tokens);
for (String r: t) {
if (r.length() > 0 &&
content.indexOf(" " + r + " ") < 0 &&

@ -66,7 +66,7 @@ public class TextSnippetTest {
String rstr = ts.getError();
assertEquals("testTextSnippet Error Code: ", "", rstr);
String[] wordlist = querywords.split(" ");
String[] wordlist = CommonPattern.SPACE.split(querywords);
rstr = ts.toString();
System.out.println("testTextSnippet: query=" + querywords);
System.out.println("testTextSnippet: snippet=" + rstr);
@ -111,7 +111,7 @@ public class TextSnippetTest {
rstr = ts.getLineMarked(qg);
System.out.println("testGetLineMarked: query=" + querywords);
System.out.println("testGetLineMarked: snippet=" + rstr);
String[] wordlist = querywords.split(" ");
String[] wordlist = CommonPattern.SPACE.split(querywords);
for (String wordstr : wordlist) {
assertTrue("testGetLineMarked marked word " + wordstr, rstr.contains("<b>" + wordstr + "</b>"));
}

Loading…
Cancel
Save