You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by rw...@apache.org on 2013/01/03 17:56:36 UTC
svn commit: r1428467 [4/4] - in /stanbol/trunk/commons/solr/extras: paoding/
paoding/src/ paoding/src/main/ paoding/src/main/java/
paoding/src/main/java/net/ paoding/src/main/java/net/paoding/
paoding/src/main/java/net/paoding/analysis/ paoding/src/mai...
Added: stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/LetterKnife.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/LetterKnife.java?rev=1428467&view=auto
==============================================================================
--- stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/LetterKnife.java (added)
+++ stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/LetterKnife.java Thu Jan 3 16:56:34 2013
@@ -0,0 +1,55 @@
+/**
+ * Copyright 2007 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.paoding.analysis.knife;
+
+
+/**
+ *
+ * @author Zhiliang Wang [qieqie.wang@gmail.com]
+ *
+ */
+public class LetterKnife extends CombinatoricsKnife {
+
+ public static final String[] DEFAULT_NOISE = { "a", "an", "and", "are", "as", "at",
+ "be", "but", "by", "for", "if", "in", "into", "is", "it", "no",
+ "not", "of", "on", "or", "such", "that", "the", "their", "then",
+ "there", "these", "they", "this", "to", "was", "will", "with",
+ "www" };
+
+
+ public LetterKnife() {
+ super(DEFAULT_NOISE);
+ }
+
+ public LetterKnife(String[] noiseWords) {
+ super(noiseWords);
+ }
+
+ public int assignable(Beef beef, int offset, int index) {
+ char ch = beef.charAt(index);
+ if (CharSet.isLantingLetter(ch)) {
+ return ASSIGNED;
+ }
+ if (index > offset) {
+ if ((ch >= '0' && ch <= '9') || ch == '-' || ch == '_') {
+ return POINT;
+ }
+ }
+ return LIMIT;
+ }
+
+
+}
Added: stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/NumberKnife.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/NumberKnife.java?rev=1428467&view=auto
==============================================================================
--- stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/NumberKnife.java (added)
+++ stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/NumberKnife.java Thu Jan 3 16:56:34 2013
@@ -0,0 +1,171 @@
+/**
+ * Copyright 2007 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.paoding.analysis.knife;
+
+import java.math.BigInteger;
+
+import net.paoding.analysis.dictionary.Dictionary;
+import net.paoding.analysis.dictionary.Hit;
+
+/**
+ *
+ * @author Zhiliang Wang [qieqie.wang@gmail.com]
+ *
+ */
+public class NumberKnife extends CombinatoricsKnife implements DictionariesWare {
+
+ private Dictionary units;
+
+ public NumberKnife() {
+ }
+
+ public NumberKnife(Dictionaries dictionaries) {
+ setDictionaries(dictionaries);
+ }
+
+ public void setDictionaries(Dictionaries dictionaries) {
+ super.setDictionaries(dictionaries);
+ units = dictionaries.getUnitsDictionary();
+ }
+
+
+ public int assignable(Beef beef, int offset, int index) {
+ char ch = beef.charAt(index);
+ if (CharSet.isArabianNumber(ch))
+ return ASSIGNED;
+ if (index > offset) {
+ if (CharSet.isLantingLetter(ch) || ch == '.' || ch == '-' || ch == '_') {
+ if (ch == '-' || ch == '_' || CharSet.isLantingLetter(ch)
+ || !CharSet.isArabianNumber(beef.charAt(index + 1))) {
+ //åè¯ææ
+ //123.456 ->123.456/
+ //123.abc.34 ->123/123.abc.34/abc/34/ ["abc"ã"abc/34"ç³»ç±LetterKnifeååºï¼éNumberKnife]
+ //没ææå¤æ!CharSet.isArabianNumber(beef.charAt(index + 1))ï¼åååº"123."ï¼èé"123"
+ //123.abc.34 ->123./123.abc.34/abc/34/
+ return POINT;
+ }
+ return ASSIGNED;
+ }
+ }
+ return LIMIT;
+ }
+
+ protected int collectLimit(Collector collector, Beef beef,
+ int offset, int point, int limit, int dicWordVote) {
+ // "123abc"çç´æ¥è°ç¨superç
+ if (point != -1) {
+ return super.collectLimit(collector, beef, offset, point, limit, dicWordVote);
+ }
+ //
+ // 2.2两
+ // ^=_point
+ //
+ final int _point = limit;
+ // å½åå°è¯å¤æçå符çä½ç½®
+ int curTail = offset;
+ /*
+ * Fix issue 56: 䏿æ°åè§£æé®é¢åç»
+ */
+ BigInteger number1 = BigInteger.valueOf(-1);
+ BigInteger number2 = BigInteger.valueOf(-1);
+ int bitValue = 0;
+ int maxUnit = 0;
+ //TODO:è¿éåéå¤ä»curTail(å
¶å¼ä¸ºoffset)夿ï¼éæ°éå夿æ¯å¦ä¸ºæ°åï¼ç®æ¯ä¸ä¸ªéå¤è®¡ç®
+ //ä½èèè¿ä¸ªè®¡ç®å¯¹ä¸æåè¯æ§è½å½±åå¾®ä¹å
¶å¾®ææ¶å
ä¸ä¼å
+ for (; (bitValue = CharSet.toNumber(beef.charAt(curTail))) >= 0; curTail++) {
+ //
+ if (bitValue == 2
+ && (beef.charAt(curTail) == '两' || beef.charAt(curTail) == '俩' || beef
+ .charAt(curTail) == 'å')) {
+ if (curTail != offset) {
+ break;
+ }
+ }
+ // å¤çè¿ç»æ±å个ä½å¼çæ°åï¼"ä¸åäºå
" ->"3456"
+ if (bitValue >= 0 && bitValue < 10) {
+ if (number2.compareTo(BigInteger.ZERO) < 0)
+ number2 = BigInteger.valueOf(bitValue);
+ else {
+ number2 = number2.multiply(BigInteger.valueOf(10));
+ number2 = number2.add(BigInteger.valueOf(bitValue));
+ }
+ } else {
+ if (number2.compareTo(BigInteger.ZERO) < 0) {
+ if (number1.compareTo(BigInteger.ZERO) < 0) {
+ number1 = BigInteger.ONE;
+ }
+ number1 = number1.multiply(BigInteger.valueOf(bitValue));
+ } else {
+ if (number1.compareTo(BigInteger.ZERO) < 0) {
+ number1 = BigInteger.ZERO;
+ }
+ if (bitValue >= maxUnit) {
+ number1 = number1.add(number2);
+ number1 = number1.multiply(BigInteger.valueOf(bitValue));
+ maxUnit = bitValue;
+ } else {
+ number1 = number1.add(number2.multiply(BigInteger.valueOf(bitValue)));
+ }
+ }
+ number2 = BigInteger.valueOf(-1);
+ }
+ }
+ if (number2.compareTo(BigInteger.ZERO) > 0) {
+ if (number1.compareTo(BigInteger.ZERO) < 0) {
+ number1 = number2;
+ } else {
+ number1 = number1.add(number2);
+ }
+ }
+ if (number1.compareTo(BigInteger.ZERO) >= 0 && curTail > _point) {
+ doCollect(collector, String.valueOf(number1), beef, offset, curTail);
+ }
+ else {
+ super.collectLimit(collector, beef, offset, point, limit, dicWordVote);
+ }
+
+ curTail = curTail > limit ? curTail : limit;
+
+ //
+ // åé¢å¯è½è·äºè®¡éåä½
+ if (units != null && CharSet.isCjkUnifiedIdeographs(beef.charAt(curTail))) {
+ Hit wd = null;
+ Hit wd2 = null;
+ int i = curTail + 1;
+
+ /*
+ * Fix issue 48: æ¥æ¾è®¡éåä½å¼èµ·çé«äº®è¶çé误
+ */
+ while (i <= limit && (wd = units.search(beef, curTail, i - curTail)).isHit()) {
+ wd2 = wd;
+ i++;
+ if (!wd.isUnclosed()) {
+ break;
+ }
+ }
+ i --;
+ if (wd2 != null) {
+ collector.collect(wd2.getWord().getText(), curTail, i);
+ return i;
+ }
+ }
+ //
+
+ return curTail > limit ? curTail : -1;
+ }
+
+
+}
Added: stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/Paoding.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/Paoding.java?rev=1428467&view=auto
==============================================================================
--- stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/Paoding.java (added)
+++ stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/Paoding.java Thu Jan 3 16:56:34 2013
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2007 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.paoding.analysis.knife;
+
+
+/**
+ * Paodingæ¯ä¸ä¸ªèçâåç®±â(å
èåç§âåâ)æ¯çç²¾åâè§£çâç人ï¼å³âåºä¸âã
+ * <p>
+ * æ£å ä¸ºä»æ¥æåç§ä¸åçâåâï¼èä¸è½å¤è¯å«ä»ä¹âè(å符)âåºè¯¥ç¨ä»ä¹âåâåå²ï¼æä»¥ä»è½æ¸¸åæä½å°ææ´å¤´çåå²ï¼æä¸ºåéçâèç(è¯è¯)âã <br>
+ * è¿éçâåâç±Knifeæ®æ¼ï¼åç§âåâç±âåç®±âKnifeBox管ç(Paoding对象æ¬èº«å°±æ¯ä¸ä¸ªKnifeBox)ï¼å¹¶ç±KnifeBoxå³çä»ä¹æ¶ååºä»ä¹âåâã
+ *
+ * @author Zhiliang Wang [qieqie.wang@gmail.com]
+ *
+ * @see Knife
+ * @see KnifeBox
+ *
+ * @since 1.0
+ */
+public class Paoding extends SmartKnifeBox implements Knife {
+
+}
Added: stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/PaodingMaker.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/PaodingMaker.java?rev=1428467&view=auto
==============================================================================
--- stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/PaodingMaker.java (added)
+++ stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/PaodingMaker.java Thu Jan 3 16:56:34 2013
@@ -0,0 +1,677 @@
+/**
+ * Copyright 2007 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.paoding.analysis.knife;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.reflect.Method;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+import net.paoding.analysis.Constants;
+import net.paoding.analysis.analyzer.impl.MostWordsModeDictionariesCompiler;
+import net.paoding.analysis.analyzer.impl.SortingDictionariesCompiler;
+import net.paoding.analysis.dictionary.support.detection.Difference;
+import net.paoding.analysis.dictionary.support.detection.DifferenceListener;
+import net.paoding.analysis.exception.PaodingAnalysisException;
+
+import org.apache.lucene.store.FSLockFactory;
+import org.apache.lucene.store.Lock;
+import org.apache.lucene.store.LockObtainFailedException;
+import org.apache.lucene.store.NativeFSLockFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author Zhiliang Wang [qieqie.wang@gmail.com]
+ *
+ * @since 2.0.0
+ */
+public class PaodingMaker {
+
+ public static final String DEFAULT_PROPERTIES_PATH = "classpath:paoding-analysis.properties";
+
+ private PaodingMaker() {
+ }
+
+ private static Logger log = LoggerFactory.getLogger(PaodingMaker.class);
+
+ private static ObjectHolder/* <Properties> */propertiesHolder = new ObjectHolder/* <Properties> */();
+
+ private static ObjectHolder/* <Paoding> */paodingHolder = new ObjectHolder/* <Paoding> */();
+
+ // ----------------è·åPaodingå¯¹è±¡çæ¹æ³-----------------------
+
+ /**
+ *
+ * 读å类路å¾ä¸çpaoding-analysis.propertiesæä»¶ï¼æ®ä¹è·åä¸ä¸ªPaoding对象ï¼
+ * <p>
+ * ç¬¬ä¸æ¬¡è°ç¨æ¬æ¹æ³æ¶ï¼ä»è¯¥å±æ§æä»¶ä¸è¯»åé
ç½®ï¼å¹¶å建ä¸ä¸ªæ°çPaoding对象ï¼ä¹åï¼å¦æ
+ * 屿§æä»¶æ²¡æåæ´è¿ï¼åæ¯æ¬¡è°ç¨æ¬æ¹æ³é½å°è¿åå
åå建çPaoding对象ãèä¸éæ°æå»º Paoding对象ã
+ * <p>
+ *
+ * 妿é
ç½®æä»¶æ²¡æåæ´ï¼ä½è¯å
¸æä»¶æåæ´ãä»ç¶æ¯è¿ååæ ·çPaoding对象ãè䏿¯ï¼åªè¦
+ * è¯å
¸æä»¶åçäºåæ´ï¼Paoding对象å¨ä¸å®æ¶é´å
伿¶å°æ´æ°çãæä»¥è¿åçPaoding对象 ä¸å®æ¯ææ°é
ç½®çã
+ *
+ *
+ *
+ * @return
+ */
+ public static Paoding make() {
+ return make(DEFAULT_PROPERTIES_PATH);
+ }
+
+ /**
+ * 读åç±»æå®è·¯å¾çé
ç½®æä»¶(妿é
ç½®æä»¶æ¾ç½®å¨ç±»è·¯å¾ä¸ï¼ååºè¯¥å "classpath:"为åç¼)ï¼æ®ä¹è·åä¸ä¸ªæ°çPaoding对象ï¼
+ * <p>
+ *
+ * ç¬¬ä¸æ¬¡è°ç¨æ¬æ¹æ³æ¶ï¼ä»è¯¥å±æ§æä»¶ä¸è¯»åé
ç½®ï¼å¹¶å建ä¸ä¸ªæ°çPaoding对象ï¼ä¹åï¼å¦æ
+ * 屿§æä»¶æ²¡æåæ´è¿ï¼åæ¯æ¬¡è°ç¨æ¬æ¹æ³é½å°è¿åå
åå建çPaoding对象ãèä¸éæ°æå»º Paoding对象ã
+ * <p>
+ *
+ * 妿é
ç½®æä»¶æ²¡æåæ´ï¼ä½è¯å
¸æä»¶æåæ´ãä»ç¶æ¯è¿ååæ ·çPaoding对象ãè䏿¯ï¼åªè¦
+ * è¯å
¸æä»¶åçäºåæ´ï¼Paoding对象å¨ä¸å®æ¶é´å
伿¶å°æ´æ°çãæä»¥è¿åçPaoding对象 ä¸å®æ¯ææ°é
ç½®çã
+ *
+ * @param propertiesPath
+ * @return
+ */
+ public static Paoding make(String propertiesPath) {
+ return make(getProperties(propertiesPath));
+ }
+
+ /**
+ * æ ¹æ®ç»å®ç屿§å¯¹è±¡è·åä¸ä¸ªPaoding对象ï¼
+ * <p>
+ *
+ * @param properties
+ * @return
+ */
+ public static Paoding make(Properties p) {
+ postPropertiesLoaded(p);
+ return implMake(p);
+ }
+
+ // --------------------------------------------------
+
+ public static Properties getProperties() {
+ return getProperties(DEFAULT_PROPERTIES_PATH);
+ }
+
+ public static Properties getProperties(String path) {
+ if (path == null) {
+ throw new NullPointerException("path should not be null!");
+ }
+ try {
+ //
+ Properties p = (Properties) propertiesHolder.get(path);
+ if (p == null || modified(p)) {
+ p = loadProperties(new Properties(), path);
+ propertiesHolder.set(path, p);
+ paodingHolder.remove(path);
+ postPropertiesLoaded(p);
+ String absolutePaths = p
+ .getProperty("paoding.analysis.properties.files.absolutepaths");
+ log.info("config paoding analysis from: " + absolutePaths);
+ }
+ return p;
+ } catch (IOException e) {
+ throw new PaodingAnalysisException(e);
+ }
+ }
+
+ // -------------------ç§æ æ è¾
婿¹æ³----------------------------------
+
+ private static boolean modified(Properties p) throws IOException {
+ String lastModifieds = p
+ .getProperty("paoding.analysis.properties.lastModifieds");
+ String[] lastModifedsArray = lastModifieds.split(";");
+ String files = p.getProperty("paoding.analysis.properties.files");
+ String[] filesArray = files.split(";");
+ for (int i = 0; i < filesArray.length; i++) {
+ File file = getFile(filesArray[i]);
+ if (file.exists()
+ && !String.valueOf(getFileLastModified(file)).equals(
+ lastModifedsArray[i])) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static Properties loadProperties(Properties p, String path)
+ throws IOException {
+ URL url;
+ File file;
+ String absolutePath;
+ InputStream in;
+ // è¥ifexists为çè¡¨ç¤ºå¦æè¯¥æä»¶åå¨å读åä»çå
容ï¼ä¸åå¨å忽ç¥å®
+ boolean skipWhenNotExists = false;
+ if (path.startsWith("ifexists:")) {
+ skipWhenNotExists = true;
+ path = path.substring("ifexists:".length());
+ }
+ if (path.startsWith("classpath:")) {
+ path = path.substring("classpath:".length());
+ url = getClassLoaderResource(path);
+ if (url == null) {
+ if (skipWhenNotExists) {
+ return p;
+ }
+ throw new FileNotFoundException("Not found " + path
+ + " in classpath.");
+ }
+
+ /*
+ * Fix issue 42 : 读åé
ç½®æä»¶çä¸ä¸ªBug
+ */
+ file = new File(getUrlPath(url));
+ in = url.openStream();
+ } else {
+ if (path.startsWith("dic-home:")) {
+ File dicHome = new File(getDicHome(p));
+ path = path.substring("dic-home:".length());
+ file = new File(dicHome, path);
+ } else {
+ file = new File(path);
+ }
+ if (skipWhenNotExists && !file.exists()) {
+ return p;
+ }
+ in = new FileInputStream(file);
+ }
+ absolutePath = file.getAbsolutePath();
+ p.load(in);
+ in.close();
+ String lastModifieds = p
+ .getProperty("paoding.analysis.properties.lastModifieds");
+ String files = p.getProperty("paoding.analysis.properties.files");
+ String absolutePaths = p
+ .getProperty("paoding.analysis.properties.files.absolutepaths");
+ if (lastModifieds == null) {
+ p.setProperty("paoding.dic.properties.path", path);
+ lastModifieds = String.valueOf(getFileLastModified(file));
+ files = path;
+ absolutePaths = absolutePath;
+ } else {
+ lastModifieds = lastModifieds + ";" + getFileLastModified(file);
+ files = files + ";" + path;
+ absolutePaths = absolutePaths + ";" + absolutePath;
+ }
+ p.setProperty("paoding.analysis.properties.lastModifieds",
+ lastModifieds);
+ p.setProperty("paoding.analysis.properties.files", files);
+ p.setProperty("paoding.analysis.properties.files.absolutepaths",
+ absolutePaths);
+ String importsValue = p.getProperty("paoding.imports");
+ if (importsValue != null) {
+ p.remove("paoding.imports");
+ String[] imports = importsValue.split(";");
+ for (int i = 0; i < imports.length; i++) {
+ loadProperties(p, imports[i]);
+ }
+ }
+ return p;
+ }
+
+ private static long getFileLastModified(File file) throws IOException {
+ String path = file.getPath();
+ int jarIndex = path.indexOf(".jar!");
+ if (jarIndex == -1) {
+ return file.lastModified();
+ } else {
+ path = path.replaceAll("%20", " ").replaceAll("\\\\", "/");
+ jarIndex = path.indexOf(".jar!");
+ int protocalIndex = path.indexOf(":");
+ String jarPath = path.substring(protocalIndex + ":".length(),
+ jarIndex + ".jar".length());
+ File jarPathFile = new File(jarPath);
+ JarFile jarFile;
+ try {
+ jarFile = new JarFile(jarPathFile);
+ String entryPath = path.substring(jarIndex + ".jar!/".length());
+ JarEntry entry = jarFile.getJarEntry(entryPath);
+ return entry.getTime();
+ } catch (IOException e) {
+ System.err.println("error in handler path=" + path);
+ System.err.println("error in handler jarPath=" + jarPath);
+ throw e;
+ }
+ }
+ }
+
+ private static String getDicHome(Properties p) {
+ setDicHomeProperties(p);
+ return p.getProperty("paoding.dic.home.absolute.path");
+ }
+
+ private static void postPropertiesLoaded(Properties p) {
+ if ("done".equals(p
+ .getProperty("paoding.analysis.postPropertiesLoaded"))) {
+ return;
+ }
+ setDicHomeProperties(p);
+ p.setProperty("paoding.analysis.postPropertiesLoaded", "done");
+ }
+
+ private static void setDicHomeProperties(Properties p) {
+ String dicHomeAbsultePath = p
+ .getProperty("paoding.dic.home.absolute.path");
+ if (dicHomeAbsultePath != null) {
+ return;
+ }
+ // è·åè¯å
¸å®è£
ç®å½é
ç½®ï¼
+ // å¦é
ç½®äºPAODING_DIC_HOMEç¯å¢åéï¼åå°å
¶ä½ä¸ºåå
¸çå®è£
主ç®å½
+ // å¦å使ç¨å±æ§æä»¶çpaoding.dic.homeé
ç½®
+ // 使¯å¦æå±æ§æä»¶ä¸å¼ºå¶é
ç½®paoding.dic.home.config-first=thisï¼
+ // åä¼å
èè屿§æä»¶çpaoding.dic.homeé
ç½®ï¼
+ // æ¤æ¶åªæå½å±æ§æä»¶æ²¡æé
ç½®paoding.dic.homeæ¶æä¼éç¨ç¯å¢åéçé
ç½®
+ String dicHomeBySystemEnv = null;
+ try {
+ dicHomeBySystemEnv = getSystemEnv(Constants.ENV_PAODING_DIC_HOME);
+ } catch (Error e) {
+ log.warn("System.getenv() is not supported in JDK1.4. ",e);
+ }
+ if(dicHomeBySystemEnv == null){
+ dicHomeBySystemEnv = System.getProperty(Constants.ENV_PAODING_DIC_HOME);
+ }
+ String dicHome = getProperty(p, Constants.DIC_HOME);
+ if (dicHomeBySystemEnv != null) {
+ String first = getProperty(p, Constants.DIC_HOME_CONFIG_FIRST);
+ if (first != null && first.equalsIgnoreCase("this")) {
+ if (dicHome == null) {
+ dicHome = dicHomeBySystemEnv;
+ }
+ } else {
+ dicHome = dicHomeBySystemEnv;
+ }
+ }
+ // 妿ç¯å¢åéå屿§æä»¶é½æ²¡æé
ç½®è¯å
¸å®è½¬ç®å½
+ // åå°è¯å¨å½åç®å½å类路å¾ä¸å¯»æ¾æ¯å¦ædicç®å½ï¼
+ // è¥æï¼åé纳ä»ä¸ºpaoding.dic.home
+ // 妿å°è¯åå失败ï¼åæåºPaodingAnalysisExceptionå¼å¸¸
+ if (dicHome == null) {
+ File f = new File("dic");
+ if (f.exists()) {
+ dicHome = "dic/";
+ } else {
+ URL url = PaodingMaker.class.getClassLoader()
+ .getResource("dic");
+ if (url != null) {
+ dicHome = "classpath:dic/";
+ }
+ }
+ }
+ if (dicHome == null) {
+ throw new PaodingAnalysisException(
+ "please set a system env PAODING_DIC_HOME or Config paoding.dic.home in paoding-dic-home.properties point to the dictionaries!");
+ }
+ // è§èådicHomeï¼å¹¶è®¾ç½®å°å±æ§æä»¶å¯¹è±¡ä¸
+ dicHome = dicHome.replace('\\', '/');
+ if (!dicHome.endsWith("/")) {
+ dicHome = dicHome + "/";
+ }
+ p.setProperty(Constants.DIC_HOME, dicHome);// writer to the properites
+ // object
+ // å°dicHome转å为ä¸ä¸ªç³»ç»å¯ä¸çç»å¯¹è·¯å¾ï¼è®°å½å¨å±æ§å¯¹è±¡ä¸
+ File dicHomeFile = getFile(dicHome);
+ if (!dicHomeFile.exists()) {
+ throw new PaodingAnalysisException(
+ "not found the dic home dirctory! "
+ + dicHomeFile.getAbsolutePath());
+ }
+ if (!dicHomeFile.isDirectory()) {
+ throw new PaodingAnalysisException(
+ "dic home should not be a file, but a directory!");
+ }
+ p.setProperty("paoding.dic.home.absolute.path", dicHomeFile
+ .getAbsolutePath());
+ }
+
+ private static Paoding implMake(final Properties p) {
+ // å°è¦è¿åçPaoding对象ï¼å®å¯è½æ¯æ°å建çï¼ä¹å¯è½ä½¿ç¨paodingHolderä¸å·²æçPaoding对象
+ Paoding paoding;
+ // ä½ä¸ºæ¬æ¬¡è¿åçPaoding对象å¨paodingHolderä¸çkeyï¼ä½¿ä¹ååæ ·çkeyä¸ä¼éå¤å建Paoding对象
+ final Object paodingKey;
+ // å¦æè¯¥å±æ§å¯¹è±¡æ¯éè¿PaodingMakerç±æä»¶è¯»å
¥çï¼åå¿
ç¶åå¨paoding.dic.properties.path屿§
+ // 详ç»è¯·åèloadPropertiesæ¹æ³)
+ String path = p.getProperty("paoding.dic.properties.path");
+ // å¦æè¯¥å±æ§ç±æä»¶è¯»å
¥ï¼åæä»¶å°åä½ä¸ºPaoding对象å¨paodingHolderä¸çkey
+ if (path != null) {
+ paodingKey = path;
+ // å¦å以屿§æä»¶ä½ä¸ºå
¶keyï¼ä¹ååªè¦è¿æ¥çæ¯åä¸ä¸ªå±æ§å¯¹è±¡ï¼é½è¿ååä¸ä¸ªPaoding对象
+ } else {
+ paodingKey = p;
+ }
+ paoding = (Paoding) paodingHolder.get(paodingKey);
+ if (paoding != null) {
+ return paoding;
+ }
+ try {
+ paoding = createPaodingWithKnives(p);
+ final Paoding finalPaoding = paoding;
+ //
+ String compilerClassName = getProperty(p,
+ Constants.ANALYZER_DICTIONARIES_COMPILER);
+ Class compilerClass = null;
+ if (compilerClassName != null) {
+ compilerClass = Class.forName(compilerClassName);
+ }
+ if (compilerClass == null) {
+ String analyzerMode = getProperty(p, Constants.ANALYZER_MODE);
+ if ("most-words".equalsIgnoreCase(analyzerMode)
+ || "default".equalsIgnoreCase(analyzerMode)) {
+ compilerClass = MostWordsModeDictionariesCompiler.class;
+ } else {
+ compilerClass = SortingDictionariesCompiler.class;
+ }
+ }
+ final DictionariesCompiler compiler = (DictionariesCompiler) compilerClass
+ .newInstance();
+ new Function() {
+ public void run() throws Exception {
+ String LOCK_FILE = "write.lock";
+ String dicHome = p
+ .getProperty("paoding.dic.home.absolute.path");
+ FSLockFactory FileLockFactory = new NativeFSLockFactory(
+ dicHome);
+ Lock lock = FileLockFactory.makeLock(LOCK_FILE);
+
+ boolean obtained = false;
+ try {
+ obtained = lock.obtain(90000);
+ if (obtained) {
+ // ç¼è¯è¯å
¸-对è¯å
¸è¿è¡å¯è½çå¤çï¼ä»¥ç¬¦ååè¯å¨çè¦æ±
+ if (compiler.shouldCompile(p)) {
+ Dictionaries dictionaries = readUnCompiledDictionaries(p);
+ Paoding tempPaoding = createPaodingWithKnives(p);
+ setDictionaries(tempPaoding, dictionaries);
+ compiler.compile(dictionaries, tempPaoding, p);
+ }
+
+ // 使ç¨ç¼è¯åçè¯å
¸
+ final Dictionaries dictionaries = compiler
+ .readCompliedDictionaries(p);
+ setDictionaries(finalPaoding, dictionaries);
+
+ // å¯å¨åå
¸å¨æè½¬è½½/å¸è½½æ£æµå¨
+ // ä¾¦æµæ¶é´é´é(ç§)ãé»è®¤ä¸º60ç§ãå¦æè®¾ç½®ä¸ºï¼æè´æ°å表示ä¸éè¦è¿è¡æ£æµ
+ String intervalStr = getProperty(p,
+ Constants.DIC_DETECTOR_INTERVAL);
+ int interval = Integer.parseInt(intervalStr);
+ if (interval > 0) {
+ dictionaries.startDetecting(interval,
+ new DifferenceListener() {
+ public void on(Difference diff)
+ throws Exception {
+ dictionaries.stopDetecting();
+
+ // æ¤å¤è°ç¨runæ¹æ³ï¼ä»¥å½æ£æµå°**ç¼è¯å**çè¯å
¸åæ´/å é¤/å¢å æ¶ï¼
+ // éæ°ç¼è¯æºè¯å
¸ãéæ°å建并å¯å¨dictionariesèªæ£æµ
+ run();
+ }
+ });
+ }
+ }
+ } catch (LockObtainFailedException ex) {
+ log.error("Obtain " + LOCK_FILE + " in " + dicHome
+ + " failed:" + ex.getMessage());
+ throw ex;
+ } catch (IOException ex) {
+ log.error("Obtain " + LOCK_FILE + " in " + dicHome
+ + " failed:" + ex.getMessage());
+ throw ex;
+ } finally {
+ if (obtained) {
+ try {
+ lock.release();
+ } catch (Exception ex) {
+
+ }
+ }
+ }
+ }
+ }.run();
+ // Paoding对象å建æåï¼æ¤æ¶å¯ä»¥å°å®å¯æ¾å°paodingHolderä¸ï¼ç»ä¸æ¬¡éå¤å©ç¨
+ paodingHolder.set(paodingKey, paoding);
+ return paoding;
+ } catch (Exception e) {
+ throw new PaodingAnalysisException("", e);
+ }
+ }
+
+ private static Paoding createPaodingWithKnives(Properties p)
+ throws Exception {
+ // 妿PaodingHolderä¸å¹¶æ²¡æç¼åè¯¥å±æ§æä»¶æå¯¹è±¡å¯¹åºçPaoding对象ï¼
+ // åæ ¹æ®ç»å®ç屿§å建ä¸ä¸ªæ°çPaoding对象ï¼å¹¶å¨è¿åä¹ååå
¥paodingHolder
+ Paoding paoding = new Paoding();
+
+ // 寻æ¾ä¼ 说ä¸çKnifeãããã
+ final Map /* <String, Knife> */knifeMap = new HashMap /*
+ * <String,
+ * Knife>
+ */();
+ final List /* <Knife> */knifeList = new LinkedList/* <Knife> */();
+ final List /* <Function> */functions = new LinkedList/* <Function> */();
+ Iterator iter = p.entrySet().iterator();
+ while (iter.hasNext()) {
+ Map.Entry e = (Map.Entry) iter.next();
+ final String key = (String) e.getKey();
+ final String value = (String) e.getValue();
+ int index = key.indexOf(Constants.KNIFE_CLASS);
+ if (index == 0 && key.length() > Constants.KNIFE_CLASS.length()) {
+ final int end = key
+ .indexOf('.', Constants.KNIFE_CLASS.length());
+ if (end == -1) {
+ Class clazz = Class.forName(value);
+ Knife knife = (Knife) clazz.newInstance();
+ knifeList.add(knife);
+ knifeMap.put(key, knife);
+ log.info("add knike: " + value);
+ } else {
+ // ç±äºå±æ§å¯¹è±¡å±äºhash表ï¼keyç读å顺åºä¸åæä»¶ç顺åºä¸è´ï¼ä¸è½ä¿è¯å±æ§è®¾ç½®æ¶ï¼knife对象已ç»å建
+ // æä»¥è¿éåªå®ä¹å½æ°æ¾å°functionsä¸ï¼å¾
å°ææçknifeé½å建ä¹åï¼å¨æ§è¡è¯¥ç¨åº
+ functions.add(new Function() {
+ public void run() throws Exception {
+ String knifeName = key.substring(0, end);
+ Object obj = knifeMap.get(knifeName);
+ if (!obj
+ .getClass()
+ .getName()
+ .equals(
+ "org.springframework.beans.BeanWrapperImpl")) {
+ Class beanWrapperImplClass = Class
+ .forName("org.springframework.beans.BeanWrapperImpl");
+ Method setWrappedInstance = beanWrapperImplClass
+ .getMethod("setWrappedInstance",
+ new Class[] { Object.class });
+ Object beanWrapperImpl = beanWrapperImplClass
+ .newInstance();
+ setWrappedInstance.invoke(beanWrapperImpl,
+ new Object[] { obj });
+ knifeMap.put(knifeName, beanWrapperImpl);
+ obj = beanWrapperImpl;
+ }
+ String propertyName = key.substring(end + 1);
+ Method setPropertyValue = obj.getClass().getMethod(
+ "setPropertyValue",
+ new Class[] { String.class, Object.class });
+ setPropertyValue.invoke(obj, new Object[] {
+ propertyName, value });
+ }
+ });
+ }
+ }
+ }
+ // 宿ææçåæ§è¡çç¨åº
+ for (Iterator iterator = functions.iterator(); iterator.hasNext();) {
+ Function function = (Function) iterator.next();
+ function.run();
+ }
+ // æå交ç»åºä¸
+ paoding.setKnives(knifeList);
+ return paoding;
+ }
+
+ private static Dictionaries readUnCompiledDictionaries(Properties p) {
+ String skipPrefix = getProperty(p, Constants.DIC_SKIP_PREFIX);
+ String noiseCharactor = getProperty(p, Constants.DIC_NOISE_CHARACTOR);
+ String noiseWord = getProperty(p, Constants.DIC_NOISE_WORD);
+ String unit = getProperty(p, Constants.DIC_UNIT);
+ String confucianFamilyName = getProperty(p,
+ Constants.DIC_CONFUCIAN_FAMILY_NAME);
+ String combinatorics = getProperty(p, Constants.DIC_FOR_COMBINATORICS);
+ String charsetName = getProperty(p, Constants.DIC_CHARSET);
+ int maxWordLen = Integer.valueOf(getProperty(p, Constants.DIC_MAXWORDLEN));
+ Dictionaries dictionaries = new FileDictionaries(getDicHome(p),
+ skipPrefix, noiseCharactor, noiseWord, unit,
+ confucianFamilyName, combinatorics, charsetName, maxWordLen);
+ return dictionaries;
+ }
+
+ private static void setDictionaries(Paoding paoding,
+ Dictionaries dictionaries) {
+ Knife[] knives = paoding.getKnives();
+ for (int i = 0; i < knives.length; i++) {
+ Knife knife = (Knife) knives[i];
+ if (knife instanceof DictionariesWare) {
+ ((DictionariesWare) knife).setDictionaries(dictionaries);
+ }
+ }
+ }
+
+ private static String getUrlPath(URL url){
+ if (url == null) return null;
+ String urlPath = null;
+ try {
+ urlPath = url.toURI().getPath();
+ } catch (URISyntaxException e) {
+ }
+ if (urlPath == null){
+ urlPath = url.getFile();
+ }
+ return urlPath;
+ }
+
+ private static File getFile(String path) {
+ File file;
+ URL url;
+ if (path.startsWith("classpath:")) {
+ path = path.substring("classpath:".length());
+ url = getClassLoaderResource(path);
+
+ /*
+ * Fix issue 42 : 读åé
ç½®æä»¶çä¸ä¸ªBug
+ */
+ if (url != null){
+ path = getUrlPath(url);
+ }
+ final boolean fileExist = url != null;
+ file = new File(path) {
+ private static final long serialVersionUID = 4009013298629147887L;
+
+ public boolean exists() {
+ return fileExist;
+ }
+ };
+ } else {
+ file = new File(path);
+ }
+ return file;
+ }
+
+ private static URL getClassLoaderResource(String path) {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ URL resource = loader != null ? loader.getResource(path) : null;
+ if (resource == null) {
+ resource = PaodingMaker.class.getClassLoader().getResource(path);
+ }
+ return resource;
+ }
+
+ private static String getProperty(Properties p, String name) {
+ return Constants.getProperty(p, name);
+ }
+
+ // --------------------------------------------------------------------
+
+ private static class ObjectHolder/* <T> */{
+
+ private ObjectHolder() {
+ }
+
+ private Map/* <Object, T> */objects = new HashMap/* <Object, T> */();
+
+ public Object/* T */get(Object name) {
+ return objects.get(name);
+ }
+
+ public void set(Object name, Object/* T */object) {
+ objects.put(name, object);
+ }
+
+ public void remove(Object name) {
+ objects.remove(name);
+ }
+ }
+
+ private static interface Function {
+ public void run() throws Exception;
+ }
+
+ private static String getSystemEnv(String name) {
+ try {
+ return System.getenv(name);
+ } catch (Error error) {
+ String osName = System.getProperty("os.name").toLowerCase();
+ try {
+ String cmd;
+ if (osName.indexOf("win") != -1) {
+ cmd = "cmd /c SET";
+ } else {
+ cmd = "/usr/bin/printenv";
+ }
+ Process process = Runtime.getRuntime().exec(cmd);
+ InputStreamReader isr = new InputStreamReader(process.getInputStream());
+ BufferedReader br = new BufferedReader(isr);
+ String line;
+ while((line = br.readLine()) != null && line.startsWith(name)) {
+ int index = line.indexOf(name + "=");
+ if (index != -1) {
+ return line.substring(index + name.length() + 1);
+ }
+ }
+ } catch (Exception e) {
+ log.warn("unable to read env from osï¼" + e.getMessage(), e);
+ }
+ }
+ return null;
+ }
+
+}
Added: stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/SmartKnifeBox.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/SmartKnifeBox.java?rev=1428467&view=auto
==============================================================================
--- stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/SmartKnifeBox.java (added)
+++ stanbol/trunk/commons/solr/extras/paoding/src/main/java/net/paoding/analysis/knife/SmartKnifeBox.java Thu Jan 3 16:56:34 2013
@@ -0,0 +1,27 @@
+/**
+ * Copyright 2007 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.paoding.analysis.knife;
+
+public class SmartKnifeBox extends KnifeBox implements Knife {
+
+ public int dissect(Collector collector, Beef beef, int offset) {
+ final int beefLength = beef.length();
+ while (offset >= 0 && offset < beefLength) {
+ offset = super.dissect(collector, beef, offset);
+ }
+ return offset;
+ }
+}
Added: stanbol/trunk/commons/solr/extras/paoding/src/main/java/org/apache/stanbol/commons/solr/extras/paoding/Activator.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/commons/solr/extras/paoding/src/main/java/org/apache/stanbol/commons/solr/extras/paoding/Activator.java?rev=1428467&view=auto
==============================================================================
--- stanbol/trunk/commons/solr/extras/paoding/src/main/java/org/apache/stanbol/commons/solr/extras/paoding/Activator.java (added)
+++ stanbol/trunk/commons/solr/extras/paoding/src/main/java/org/apache/stanbol/commons/solr/extras/paoding/Activator.java Thu Jan 3 16:56:34 2013
@@ -0,0 +1,129 @@
+package org.apache.stanbol.commons.solr.extras.paoding;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import net.paoding.analysis.Constants;
+import net.paoding.analysis.knife.PaodingMaker;
+
+import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
+import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This BundleActivator copies the paoding dictionary to the persistent storage
+ * of the bundle ( {@link BundleContext#getDataFile(String)} with argument "dict").
+ * This is necessary because this library can not read the dictionary from within
+ * a jar file.<p>
+ *
+ * @author Rupert Westenthaler
+ *
+ */
+public class Activator implements BundleActivator {
+
+ public static final String DICT_ARCHIVE = "paoding-dict.zip";
+ private static Logger log = LoggerFactory.getLogger(Activator.class);
+
+ @Override
+ public void start(BundleContext ctx) throws Exception {
+
+ File paodingDict = ctx.getDataFile("dict");
+ if(paodingDict.isFile()){
+ log.warn("Paoding dictionary root exists but is a File");
+ log.warn(" ... try to delete");
+ if(!paodingDict.delete()){
+ throw new IllegalStateException("Unable to initialise paoding dictionary because "
+ + paodingDict.getAbsolutePath() +" exists, is a file and can not be deleted!");
+ }
+ }
+ if(!paodingDict.isDirectory()){
+ log.info("initialise paoding dictionary in {}",paodingDict.getAbsolutePath());
+ InputStream in = Activator.class.getClassLoader().getResourceAsStream(DICT_ARCHIVE);
+ if(in == null){
+ throw new IllegalStateException("Unable to load paoding dictionary data from bundle "
+ + "using name "+DICT_ARCHIVE);
+ }
+ initPaodingDictionary(paodingDict,in);
+ }
+ initPaodingDictHomeProperty(paodingDict);
+ }
+
+ /**
+ * Copies the dictionary from the parsed {@link InputStream} to the
+ * parsed directory
+ * @param paodingDict
+ * @throws IOException
+ */
+ public static void initPaodingDictionary(File paodingDict, InputStream in) throws IOException {
+ if(in == null){
+ throw new IllegalArgumentException("The parsed InputStream MUST NOT be NULL");
+ }
+ if(paodingDict == null){
+ throw new IllegalArgumentException("The parsed poading dictionary MUST NOT be NULL");
+ }
+ if(paodingDict.isFile()){
+ throw new IllegalArgumentException("The parsed paoding dictionary MUST NOT be a File");
+ }
+ ZipArchiveInputStream zin = new ZipArchiveInputStream(in);
+ ZipArchiveEntry entry;
+ try {
+ while((entry = zin.getNextZipEntry()) != null){
+ if(!entry.isDirectory()){
+ File file = new File(paodingDict,entry.getName());
+ if(!file.isFile()){
+ //copy the entry
+ log.debug(" > copy {}",entry.getName());
+ IOUtils.copy(zin, FileUtils.openOutputStream(file));
+ } else {
+ log.debug(" < {} already present",entry.getName());
+ }
+ }
+ }
+ log.info(" ... paoding dictionaly initialised");
+ } catch (IOException e) {
+ log.error("Unable to initialise paoding dictionary in "
+ +paodingDict,e);
+ if(paodingDict.exists() && !paodingDict.delete()){
+ log.error("Unable to delete incomplete paoding dictionary "
+ +paodingDict+"! Please delete this directory manually before "
+ + " the next start of this Bundle!");
+ }
+ throw e;
+ }
+ }
+
+ /**
+ * @param paodingDict
+ */
+ public static void initPaodingDictHomeProperty(File paodingDict) {
+ //set the Dictionary home to the PaodingMaker. This is somewhat a workaround as
+ //setting the home directory is only supported via
+ // a) an properties file loaded via the classpath (can not be used)
+ // b) an System environment variable (Systen#getenv(..) NOT System#getProperty(..)!)
+ ClassLoader ccl = Thread.currentThread().getContextClassLoader();
+ try{
+ Thread.currentThread().setContextClassLoader(Activator.class.getClassLoader());
+ Properties p = PaodingMaker.getProperties();
+ p.setProperty(Constants.DIC_HOME, paodingDict.getAbsolutePath());
+ //actually in the already initialised properties file the dictionary home is read
+ //from the following key
+ p.setProperty("paoding.dic.home.absolute.path", paodingDict.getAbsolutePath());
+ } finally {
+ Thread.currentThread().setContextClassLoader(ccl);
+ }
+ }
+
+ @Override
+ public void stop(BundleContext ctx) throws Exception {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: stanbol/trunk/commons/solr/extras/paoding/src/main/resources/paoding-analysis.properties
URL: http://svn.apache.org/viewvc/stanbol/trunk/commons/solr/extras/paoding/src/main/resources/paoding-analysis.properties?rev=1428467&view=auto
==============================================================================
--- stanbol/trunk/commons/solr/extras/paoding/src/main/resources/paoding-analysis.properties (added)
+++ stanbol/trunk/commons/solr/extras/paoding/src/main/resources/paoding-analysis.properties Thu Jan 3 16:56:34 2013
@@ -0,0 +1,12 @@
+# Dictionary home configuration is just a dummy. It will be
+# manually set by the initialization
+paoding.dic.home=.
+#deactivate reloading as this would reset the manually overridden paoding.dict.home
+#to the value configured above
+paoding.dic.detector.interval=-1
+
+#paoding.knife config
+paoding.knife.class.letterKnife=net.paoding.analysis.knife.LetterKnife
+paoding.knife.class.numberKnife=net.paoding.analysis.knife.NumberKnife
+paoding.knife.class.cjkKnife=net.paoding.analysis.knife.CJKKnife
+
Added: stanbol/trunk/commons/solr/extras/paoding/src/main/resources/paoding-dict.zip
URL: http://svn.apache.org/viewvc/stanbol/trunk/commons/solr/extras/paoding/src/main/resources/paoding-dict.zip?rev=1428467&view=auto
==============================================================================
Binary file - no diff available.
Propchange: stanbol/trunk/commons/solr/extras/paoding/src/main/resources/paoding-dict.zip
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Propchange: stanbol/trunk/commons/solr/extras/smartcn/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Jan 3 16:56:34 2013
@@ -1 +1,7 @@
target
+
+.project
+
+.settings
+
+.classpath
Propchange: stanbol/trunk/commons/solr/extras/stempel/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Jan 3 16:56:34 2013
@@ -1 +1,7 @@
target
+
+.settings
+
+.classpath
+
+.project