Skip to content

Commit

Permalink
removed kelondro dependencies from cora
Browse files Browse the repository at this point in the history
  • Loading branch information
Orbiter committed Sep 20, 2012
1 parent 39564fd commit 63762d8
Show file tree
Hide file tree
Showing 27 changed files with 122 additions and 79 deletions.
4 changes: 2 additions & 2 deletions htroot/DictionaryLoader_p.java
Expand Up @@ -21,11 +21,11 @@
import java.io.IOException;
import java.net.MalformedURLException;

import net.yacy.cora.geo.GeonamesLocation;
import net.yacy.cora.geo.OpenGeoDBLocation;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.services.federated.yacy.CacheStrategy;
import net.yacy.document.LibraryProvider;
import net.yacy.document.geolocation.GeonamesLocation;
import net.yacy.document.geolocation.OpenGeoDBLocation;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.util.FileUtils;
Expand Down
2 changes: 1 addition & 1 deletion htroot/api/yacydoc.java
Expand Up @@ -146,7 +146,7 @@ public static serverObjects respond(final RequestHeader header, final serverObje
references += r.toString()+",";
}

JenaTripleStore.log.logInfo(references);
Log.logInfo("yacydoc", references);

prop.put("taglinks", references);

Expand Down
2 changes: 1 addition & 1 deletion htroot/yacysearch.java
Expand Up @@ -45,6 +45,7 @@
import net.yacy.cora.document.Classification.ContentDomain;
import net.yacy.cora.document.RSSMessage;
import net.yacy.cora.document.UTF8;
import net.yacy.cora.geo.GeoLocation;
import net.yacy.cora.lod.vocabulary.Tagging;
import net.yacy.cora.protocol.Domains;
import net.yacy.cora.protocol.HeaderFramework;
Expand All @@ -55,7 +56,6 @@
import net.yacy.document.Document;
import net.yacy.document.LibraryProvider;
import net.yacy.document.Parser;
import net.yacy.document.geolocation.GeoLocation;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.data.meta.URIMetadata;
import net.yacy.kelondro.data.word.Word;
Expand Down
2 changes: 1 addition & 1 deletion htroot/yacysearch_location.java
Expand Up @@ -24,12 +24,12 @@
import java.util.concurrent.TimeUnit;

import net.yacy.cora.document.RSSMessage;
import net.yacy.cora.geo.GeoLocation;
import net.yacy.cora.protocol.Domains;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.services.federated.opensearch.SRURSSConnector;
import net.yacy.document.LibraryProvider;
import net.yacy.document.geolocation.GeoLocation;
import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
import de.anomic.server.serverCore;
Expand Down
2 changes: 1 addition & 1 deletion source/de/anomic/data/DidYouMean.java
Expand Up @@ -10,8 +10,8 @@

import net.yacy.cora.sorting.ClusteredScoreMap;
import net.yacy.cora.sorting.ReversibleScoreMap;
import net.yacy.cora.util.StringBuilderComparator;
import net.yacy.document.LibraryProvider;
import net.yacy.document.StringBuilderComparator;
import net.yacy.kelondro.logging.Log;
import net.yacy.search.index.Segment;

Expand Down
5 changes: 2 additions & 3 deletions source/net/yacy/cora/document/RSSMessage.java
Expand Up @@ -38,7 +38,6 @@
import net.yacy.cora.lod.vocabulary.DublinCore;
import net.yacy.cora.lod.vocabulary.Geo;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.kelondro.data.meta.DigestURI;

public class RSSMessage implements Hit, Comparable<RSSMessage>, Comparator<RSSMessage> {

Expand Down Expand Up @@ -110,13 +109,13 @@ public RSSMessage(final String title, final String description, final String lin
this.map.put("guid", artificialGuidPrefix + Integer.toHexString((title + description + link).hashCode()));
}

public RSSMessage(final String title, final String description, final DigestURI link) {
public RSSMessage(final String title, final String description, final MultiProtocolURI link, final String guid) {
this.map = new HashMap<String, String>();
this.map.put("title", title);
this.map.put("description", description);
this.map.put("link", link.toNormalform(true, false));
this.map.put("pubDate", ISO8601Formatter.FORMATTER.format());
this.map.put("guid", ASCII.String(link.hash()));
this.map.put("guid", guid);
}

public RSSMessage() {
Expand Down
Expand Up @@ -18,7 +18,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/

package net.yacy.document;
package net.yacy.cora.document;

import java.io.BufferedReader;
import java.io.File;
Expand All @@ -37,23 +37,23 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.zip.GZIPInputStream;

import org.apache.log4j.Logger;

import net.yacy.cora.sorting.OrderedScoreMap;
import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.util.MemoryControl;
import net.yacy.cora.util.StringBuilderComparator;

/**
* provide a completion library for the did-you-mean class
*
*/
public class WordCache {

private final static Logger log = Logger.getLogger(WordCache.class);

// common word cache
private static final int commonWordsMaxSize = (int) (MemoryControl.available() / 30000); // maximum size of common word cache
private static final int commonWordsMaxSize = 20000; // maximum size of common word cache
private static final int commonWordsMinLength = 5; // words must have that length at minimum
private static OrderedScoreMap<StringBuilder> commonWords = new OrderedScoreMap<StringBuilder>(StringBuilderComparator.CASE_INSENSITIVE_ORDER);
static {
Log.logConfig("WordCache", "commonWordsMaxSize = " + commonWordsMaxSize);
}

// dictionaries
private final File dictionaryPath;
Expand Down Expand Up @@ -213,9 +213,6 @@ public static void learn(final StringBuilder word) {
if (word.length() < commonWordsMinLength) {
return;
}
if (MemoryControl.shortStatus()) {
commonWords.clear();
}
commonWords.inc(word);
if (!(commonWords.sizeSmaller(commonWordsMaxSize))) {
commonWords.shrinkToMaxSize(commonWordsMaxSize / 2);
Expand All @@ -242,7 +239,7 @@ public void reload() {
Dictionary dict = new Dictionary(new File(this.dictionaryPath, f));
this.dictionaries.put(f.substring(0, f.length() - 6), dict);
} catch (final IOException e) {
Log.logException(e);
log.warn(e);
}
}
}
Expand Down Expand Up @@ -323,6 +320,10 @@ public int size() {
}
return size;
}

public static void clear() {
commonWords.clear();
}

/**
* a property that is used during the construction of recommendation:
Expand Down
Expand Up @@ -20,7 +20,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/

package net.yacy.document.geolocation;
package net.yacy.cora.geo;

import java.util.Comparator;

Expand Down
Expand Up @@ -20,7 +20,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/

package net.yacy.document.geolocation;
package net.yacy.cora.geo;

/**
* Geolocation storage may vary using different data structures for the points.
Expand Down
Expand Up @@ -20,7 +20,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/

package net.yacy.document.geolocation;
package net.yacy.cora.geo;

import java.io.BufferedReader;
import java.io.File;
Expand All @@ -39,9 +39,10 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

import net.yacy.document.StringBuilderComparator;
import net.yacy.document.WordCache;
import net.yacy.kelondro.logging.Log;
import org.apache.log4j.Logger;

import net.yacy.cora.document.WordCache;
import net.yacy.cora.util.StringBuilderComparator;

public class GeonamesLocation implements Locations {

Expand All @@ -68,7 +69,8 @@ feature class : see http://www.geonames.org/export/codes.html, char(1)
timezone : the timezone id (see file timeZone.txt)
modification date : date of last modification in yyyy-MM-dd format
*/

private final static Logger log = Logger.getLogger(GeonamesLocation.class);

private final Map<Integer, GeoLocation> id2loc;
private final TreeMap<StringBuilder, List<Integer>> name2ids;
private final File file;
Expand All @@ -92,7 +94,7 @@ public GeonamesLocation(final File file, WordCache dymLib, long minPopulation) {
final InputStream is = zf.getInputStream(ze);
reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
} catch ( final IOException e ) {
Log.logException(e);
log.warn(e);
return;
}

Expand Down Expand Up @@ -153,7 +155,7 @@ public GeonamesLocation(final File file, WordCache dymLib, long minPopulation) {
}
}
} catch ( final IOException e ) {
Log.logException(e);
log.warn(e);
}
}

Expand Down
@@ -1,4 +1,26 @@
package net.yacy.document.geolocation;
/**
* IntegerGeoPoint
* Copyright 2009 by Michael Peter Christen; mc@yacy.net, Frankfurt a. M., Germany
* first published 08.10.2009 on http://yacy.net
*
* This file is part of YaCy Content Integration
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program in the file lgpl21.txt
* If not, see <http://www.gnu.org/licenses/>.
*/

package net.yacy.cora.geo;

/**
* GeoPoint implementation with Integer accuracy
Expand Down
Expand Up @@ -21,7 +21,7 @@
*/


package net.yacy.document.geolocation;
package net.yacy.cora.geo;

import java.util.Set;
import java.util.TreeSet;
Expand Down
Expand Up @@ -20,7 +20,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/

package net.yacy.document.geolocation;
package net.yacy.cora.geo;

import java.io.BufferedReader;
import java.io.File;
Expand All @@ -39,8 +39,8 @@
import java.util.TreeSet;
import java.util.zip.GZIPInputStream;

import net.yacy.document.StringBuilderComparator;
import net.yacy.document.WordCache;
import net.yacy.cora.document.WordCache;
import net.yacy.cora.util.StringBuilderComparator;
import net.yacy.kelondro.logging.Log;

/**
Expand Down
Expand Up @@ -20,7 +20,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/

package net.yacy.document.geolocation;
package net.yacy.cora.geo;

import java.util.HashMap;
import java.util.HashSet;
Expand Down

0 comments on commit 63762d8

Please sign in to comment.