Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

French and German analyzers added

Jerome Charron5f45c38a051c
diff --git a/src/plugin/analysis-de/build.xml b/src/plugin/analysis-de/build.xml
new file mode 100644
index 000000000..eb7084d3d
--- /dev/null
+++ b/src/plugin/analysis-de/build.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+
+<project name="analysis-de" default="jar">
+
+ <import file="../build-plugin.xml"/>
+
+ <path id="plugin.deps">
+ <fileset dir="../lib-lucene-analyzers/lib">
+ <include name="*.jar" />
+ </fileset>
+ </path>
+
+</project>
diff --git a/src/plugin/analysis-de/plugin.xml b/src/plugin/analysis-de/plugin.xml
new file mode 100644
index 000000000..f58b4d4ee
--- /dev/null
+++ b/src/plugin/analysis-de/plugin.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin
+ id="analysis-de"
+ name="German Analysis Plug-in"
+ version="1.0.0"
+ provider-name="org.apache.nutch">
+
+ <runtime>
+ <library name="analysis-de.jar">
+ <export name="*"/>
+ </library>
+ </runtime>
+
+ <requires>
+ <import plugin="nutch-extensionpoints"/>
+ <import plugin="lib-lucene-analyzers"/>
+ </requires>
+
+ <extension id="org.apache.nutch.analysis.de"
+ name="GermanAnalyzer"
+ point="org.apache.nutch.analysis.NutchAnalyzer">
+
+ <implementation id="org.apache.nutch.analysis.de.GermanAnalyzer"
+ class="org.apache.nutch.analysis.de.GermanAnalyzer"
+ lang="de"/>
+
+ </extension>
+
+</plugin>
diff --git a/src/plugin/analysis-de/src/java/org/apache/nutch/analysis/de/GermanAnalyzer.java b/src/plugin/analysis-de/src/java/org/apache/nutch/analysis/de/GermanAnalyzer.java
new file mode 100644
index 000000000..991b49f0e
--- /dev/null
+++ b/src/plugin/analysis-de/src/java/org/apache/nutch/analysis/de/GermanAnalyzer.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2005 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 org.apache.nutch.analysis.de;
+
+// JDK imports
+import java.io.Reader;
+
+// Lucene imports
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.TokenStream;
+
+// Nutch imports
+import org.apache.nutch.analysis.NutchAnalyzer;
+
+
+/**
+ * A simple German Analyzer that wraps the Lucene one.
+ * @author Jerome Charron
+ */
+public class GermanAnalyzer extends NutchAnalyzer {
+
+ private final static Analyzer ANALYZER =
+ new org.apache.lucene.analysis.de.GermanAnalyzer();
+
+
+ /** Creates a new instance of FrenchAnalyzer */
+ public GermanAnalyzer() { }
+
+
+ public TokenStream tokenStream(String fieldName, Reader reader) {
+ return ANALYZER.tokenStream(fieldName, reader);
+ }
+
+}
diff --git a/src/plugin/analysis-fr/build.xml b/src/plugin/analysis-fr/build.xml
new file mode 100644
index 000000000..031a7cfcd
--- /dev/null
+++ b/src/plugin/analysis-fr/build.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+
+<project name="analysis-fr" default="jar">
+
+ <import file="../build-plugin.xml"/>
+
+ <path id="plugin.deps">
+ <fileset dir="../lib-lucene-analyzers/lib">
+ <include name="*.jar" />
+ </fileset>
+ </path>
+
+</project>
diff --git a/src/plugin/analysis-fr/plugin.xml b/src/plugin/analysis-fr/plugin.xml
new file mode 100644
index 000000000..8f81fb4cf
--- /dev/null
+++ b/src/plugin/analysis-fr/plugin.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin
+ id="analysis-fr"
+ name="French Analysis Plug-in"
+ version="1.0.0"
+ provider-name="org.apache.nutch">
+
+ <runtime>
+ <library name="analysis-fr.jar">
+ <export name="*"/>
+ </library>
+ </runtime>
+
+ <requires>
+ <import plugin="nutch-extensionpoints"/>
+ <import plugin="lib-lucene-analyzers"/>
+ </requires>
+
+ <extension id="org.apache.nutch.analysis.fr"
+ name="FrenchAnalyzer"
+ point="org.apache.nutch.analysis.NutchAnalyzer">
+
+ <implementation id="org.apache.nutch.analysis.fr.FrenchAnalyzer"
+ class="org.apache.nutch.analysis.fr.FrenchAnalyzer"
+ lang="fr"/>
+
+ </extension>
+
+</plugin>
diff --git a/src/plugin/analysis-fr/src/java/org/apache/nutch/analysis/fr/FrenchAnalyzer.java b/src/plugin/analysis-fr/src/java/org/apache/nutch/analysis/fr/FrenchAnalyzer.java
new file mode 100644
index 000000000..4a9922d6a
--- /dev/null
+++ b/src/plugin/analysis-fr/src/java/org/apache/nutch/analysis/fr/FrenchAnalyzer.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2005 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 org.apache.nutch.analysis.fr;
+
+// JDK imports
+import java.io.Reader;
+
+// Lucene imports
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.TokenStream;
+
+// Nutch imports
+import org.apache.nutch.analysis.NutchAnalyzer;
+
+
+/**
+ * A simple French Analyzer that wraps the Lucene one.
+ * @author Jerome Charron
+ */
+public class FrenchAnalyzer extends NutchAnalyzer {
+
+ private final static Analyzer ANALYZER =
+ new org.apache.lucene.analysis.fr.FrenchAnalyzer();
+
+
+ /** Creates a new instance of FrenchAnalyzer */
+ public FrenchAnalyzer() { }
+
+
+ public TokenStream tokenStream(String fieldName, Reader reader) {
+ return ANALYZER.tokenStream(fieldName, reader);
+ }
+
+}
diff --git a/src/plugin/build.xml b/src/plugin/build.xml
index 13ba6f55b..20df737eb 100755
--- a/src/plugin/build.xml
+++ b/src/plugin/build.xml
@@ -6,6 +6,8 @@
<!-- Build & deploy all the plugin jars. -->
<!-- ====================================================== -->
<target name="deploy">
+ <!--ant dir="analysis-de" target="deploy"/-->
+ <!--ant dir="analysis-fr" target="deploy"/-->
<ant dir="clustering-carrot2" target="deploy"/>
<ant dir="creativecommons" target="deploy"/>
<ant dir="index-basic" target="deploy"/>
@@ -61,6 +63,8 @@
<!-- Clean all of the plugins. -->
<!-- ====================================================== -->
<target name="clean">
+ <ant dir="analysis-de" target="clean"/>
+ <ant dir="analysis-fr" target="clean"/>
<ant dir="clustering-carrot2" target="clean"/>
<ant dir="creativecommons" target="clean"/>
<ant dir="index-basic" target="clean"/>