lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccurr...@apache.org
Subject svn commit: r1304165 - in /incubator/lucene.net/trunk/src/contrib/Analyzers/De: GermanDIN2Stemmer.cs GermanStemFilter.cs GermanStemmerDIN2.cs
Date Fri, 23 Mar 2012 02:14:49 GMT
Author: ccurrens
Date: Fri Mar 23 02:14:49 2012
New Revision: 1304165

URL: http://svn.apache.org/viewvc?rev=1304165&view=rev
Log:
[LUCENENET-466] - Renamed GermanStemmerDIN2 to GermanDIN2Stemmer.  I think it sounds better.

Added:
    incubator/lucene.net/trunk/src/contrib/Analyzers/De/GermanDIN2Stemmer.cs
Removed:
    incubator/lucene.net/trunk/src/contrib/Analyzers/De/GermanStemmerDIN2.cs
Modified:
    incubator/lucene.net/trunk/src/contrib/Analyzers/De/GermanStemFilter.cs

Added: incubator/lucene.net/trunk/src/contrib/Analyzers/De/GermanDIN2Stemmer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/contrib/Analyzers/De/GermanDIN2Stemmer.cs?rev=1304165&view=auto
==============================================================================
--- incubator/lucene.net/trunk/src/contrib/Analyzers/De/GermanDIN2Stemmer.cs (added)
+++ incubator/lucene.net/trunk/src/contrib/Analyzers/De/GermanDIN2Stemmer.cs Fri Mar 23 02:14:49
2012
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Lucene.Net.Analysis.De
+{
+    /// <summary>
+    /// A stemmer for the german language that uses the
+    /// DIN-5007-2 "Phone Book" rules for handling
+    /// umlaut characters.
+    /// </summary>
+    public sealed class GermanDIN2Stemmer : GermanStemmer
+    {
+        protected override void SubstituteUmlauts(StringBuilder buffer, int c)
+        {
+            if (buffer[c] == 'ä')
+            {
+                buffer[c] = 'a';
+                buffer.Insert(c + 1, 'e');
+            }
+            else if (buffer[c] == 'ö')
+            {
+                buffer[c] = 'o';
+                buffer.Insert(c + 1, 'e');
+            }
+            else if (buffer[c] == 'ü')
+            {
+                buffer[c] = 'u';
+                buffer.Insert(c + 1, 'e');
+            }
+            // Fix bug so that 'ß' at the end of a word is replaced.
+            else if (buffer[c] == 'ß')
+            {
+                buffer[c] = 's';
+                buffer.Insert(c + 1, 's');
+                substCount++;
+            }
+        }
+    }
+}

Modified: incubator/lucene.net/trunk/src/contrib/Analyzers/De/GermanStemFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/contrib/Analyzers/De/GermanStemFilter.cs?rev=1304165&r1=1304164&r2=1304165&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/contrib/Analyzers/De/GermanStemFilter.cs (original)
+++ incubator/lucene.net/trunk/src/contrib/Analyzers/De/GermanStemFilter.cs Fri Mar 23 02:14:49
2012
@@ -70,7 +70,7 @@ namespace Lucene.Net.Analysis.De
             : base(_in)
         {
             exclusionSet = exclusiontable;
-            stemmer = useDin2Stemmer ? new GermanStemmerDIN2() : new GermanStemmer();
+            stemmer = useDin2Stemmer ? new GermanDIN2Stemmer() : new GermanStemmer();
             termAtt = AddAttribute<TermAttribute>();
         }
 



Mime
View raw message