lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aro...@apache.org
Subject svn commit: r501282 - in /incubator/lucene.net/trunk/C#/contrib: ./ SpellChecker.Net/ SpellChecker.Net/SpellChecker.Net/ SpellChecker.Net/SpellChecker.Net/Spell/ SpellChecker.Net/Test/ SpellChecker.Net/Test/Test/ SpellChecker.Net/Test/Util/
Date Tue, 30 Jan 2007 01:48:34 GMT
Author: aroush
Date: Mon Jan 29 17:48:32 2007
New Revision: 501282

URL: http://svn.apache.org/viewvc?view=rev&rev=501282
Log:
SpellChecker.Net 2.0.0 build 1 release.

Added:
    incubator/lucene.net/trunk/C#/contrib/README.txt
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/ABOUT.txt
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/HISTORY.txt
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/LICENSE.txt
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/AssemblyInfo.cs
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Build.xml
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/Dictionary.cs
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/LuceneDictionary.cs
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/Package.html
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/PlainTextDictionary.cs
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/SpellChecker.cs
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/SuggestWord.cs
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/SuggestWordQueue.cs
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/TRStringDistance.cs
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/SpellChecker.Net-2.0.0.csproj
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/SpellChecker.Net.sln
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/AssemblyInfo.cs
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/SpellChecker.Net.Test-2.0.0.csproj
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/SpellChecker.Net.Test.nunit
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/SpellChecker.Net.Test.sln
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/Test/
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/Test/TestSpellChecker.cs
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/Util/
    incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/Util/English.cs

Added: incubator/lucene.net/trunk/C#/contrib/README.txt
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/README.txt?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/README.txt (added)
+++ incubator/lucene.net/trunk/C#/contrib/README.txt Mon Jan 29 17:48:32 2007
@@ -0,0 +1,9 @@
+This folder contains both ported and contributed code to the Lucene.Net project.  The ported code are those from the Java to C# while the contributed code are new work which don't necessarily exist in the Java side of Lucene.  The ported code end with ".Net" and are listed in this README.txt file.
+
+
+Ported code:
+------------
+
+Highlighter.Net
+Snowball.Net
+SpellChecker.Net
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/ABOUT.txt
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/ABOUT.txt?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/ABOUT.txt (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/ABOUT.txt Mon Jan 29 17:48:32 2007
@@ -0,0 +1 @@
+SpellChecker.Net is a port of Java SpellChecker to C#.  The port from Java to C# of version 2.0.0 is done by George Aroush.  To contact George Aroush please visit http://www.aroush.net/

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/HISTORY.txt
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/HISTORY.txt?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/HISTORY.txt (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/HISTORY.txt Mon Jan 29 17:48:32 2007
@@ -0,0 +1,6 @@
+Highlighter.Net History
+-----------------------
+
+
+29Jan07:
+	- Release: SpellChecker.Net.2.0.0 build 001

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/LICENSE.txt
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/LICENSE.txt?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/LICENSE.txt (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/LICENSE.txt Mon Jan 29 17:48:32 2007
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/SpellChecker.Net/AssemblyInfo.cs?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/AssemblyInfo.cs (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/AssemblyInfo.cs Mon Jan 29 17:48:32 2007
@@ -0,0 +1,62 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+
+// TODO: Review the values of the assembly attributes
+
+[assembly: AssemblyTitle("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version
+//      Revision
+//      Build Number
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly: AssemblyVersion("2.0.0.1")]
+
+//
+// In order to sign your assembly you must specify a key to use. Refer to the 
+// Microsoft .NET Framework documentation for more information on assembly signing.
+//
+// Use the attributes below to control which key is used for signing. 
+//
+// Notes: 
+//   (*) If no key is specified, the assembly is not signed.
+//   (*) KeyName refers to a key that has been installed in the Crypto Service
+//       Provider (CSP) on your machine. KeyFile refers to a file which contains
+//       a key.
+//   (*) If the KeyFile and the KeyName values are both specified, the 
+//       following processing occurs:
+//       (1) If the KeyName can be found in the CSP, that key is used.
+//       (2) If the KeyName does not exist and the KeyFile does exist, the key 
+//           in the KeyFile is installed into the CSP and used.
+//   (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
+//       When specifying the KeyFile, the location of the KeyFile should be
+//       relative to the project output directory which is
+//       %Project Directory%\obj\<configuration>. For example, if your KeyFile is
+//       located in the project directory, you would specify the AssemblyKeyFile 
+//       attribute as [assembly: AssemblyKeyFile("..\..\mykey.snk")]
+//   (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+//       documentation for more information on this.
+//
+
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
+[assembly: AssemblyKeyName("")]
+
+

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Build.xml
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/SpellChecker.Net/Build.xml?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Build.xml (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Build.xml Mon Jan 29 17:48:32 2007
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+
+<project name="spellchecker" default="default">
+
+  <description>
+    Spell Checker
+  </description>
+
+  <import file="../contrib-build.xml"/>
+</project>

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/Dictionary.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/SpellChecker.Net/Spell/Dictionary.cs?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/Dictionary.cs (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/Dictionary.cs Mon Jan 29 17:48:32 2007
@@ -0,0 +1,39 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+using System;
+
+// org.apache.lucene.index.Term   -> Lucene.Net.Index.Term
+// org.apache.lucene.search.spell -> Lucene.Net.Search.Spell
+
+
+namespace SpellChecker.Net.Search.Spell
+{
+	
+    /// <summary> A simple interface representing a Dictionary</summary>
+    /// <author>  Nicolas Maisonneuve
+    /// </author>
+    /// <version>  1.0
+    /// </version>
+    public interface Dictionary
+    {
+        /// <summary> return all the words present in the dictionnary</summary>
+        /// <returns> Iterator
+        /// </returns>
+        System.Collections.IEnumerator GetWordsIterator();
+    }
+}
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/LuceneDictionary.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/SpellChecker.Net/Spell/LuceneDictionary.cs?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/LuceneDictionary.cs (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/LuceneDictionary.cs Mon Jan 29 17:48:32 2007
@@ -0,0 +1,130 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+using System;
+using IndexReader = Lucene.Net.Index.IndexReader;
+using TermEnum = Lucene.Net.Index.TermEnum;
+using Term = Lucene.Net.Index.Term;
+
+namespace SpellChecker.Net.Search.Spell
+{
+	
+    /// <summary> Lucene Dictionary
+    /// 
+    /// </summary>
+    /// <author>  Nicolas Maisonneuve
+    /// </author>
+    public class LuceneDictionary : Dictionary
+    {
+        virtual public System.Collections.IEnumerator GetWordsIterator()
+        {
+            return new LuceneIterator(this);
+        }
+        internal IndexReader reader;
+        internal System.String field;
+		
+        public LuceneDictionary(IndexReader reader, System.String field)
+        {
+            this.reader = reader;
+            this.field = field;
+        }
+		
+		
+        internal sealed class LuceneIterator : System.Collections.IEnumerator
+        {
+            private void  InitBlock(LuceneDictionary enclosingInstance)
+            {
+                this.enclosingInstance = enclosingInstance;
+            }
+            private LuceneDictionary enclosingInstance;
+            public System.Object Current
+            {
+                get
+                {
+                    if (!has_next_called)
+                    {
+                        MoveNext();
+                    }
+                    has_next_called = false;
+                    return (actualTerm != null) ? actualTerm.Text() : null;
+                }
+				
+            }
+            public LuceneDictionary Enclosing_Instance
+            {
+                get
+                {
+                    return enclosingInstance;
+                }
+				
+            }
+            private TermEnum termEnum;
+            private Term actualTerm;
+            private bool has_next_called;
+			
+            public LuceneIterator(LuceneDictionary enclosingInstance)
+            {
+                InitBlock(enclosingInstance);
+                try
+                {
+                    termEnum = Enclosing_Instance.reader.Terms(new Term(Enclosing_Instance.field, ""));
+                }
+                catch (System.IO.IOException ex)
+                {
+                    System.Console.Error.WriteLine(ex.StackTrace);
+                }
+            }
+			
+			
+            public bool MoveNext()
+            {
+                has_next_called = true;
+                try
+                {
+                    // if there is still words
+                    if (!termEnum.Next())
+                    {
+                        actualTerm = null;
+                        return false;
+                    }
+                    //  if the next word are in the field
+                    actualTerm = termEnum.Term();
+                    System.String fieldt = actualTerm.Field();
+                    if ((System.Object) fieldt != (System.Object) Enclosing_Instance.field)
+                    {
+                        actualTerm = null;
+                        return false;
+                    }
+                    return true;
+                }
+                catch (System.IO.IOException ex)
+                {
+                    System.Console.Error.WriteLine(ex.StackTrace);
+                    return false;
+                }
+            }
+			
+            public void  Remove()
+            {
+            }
+			
+            public void  Reset()
+            {
+            }
+        }
+    }
+}
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/Package.html
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/SpellChecker.Net/Spell/Package.html?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/Package.html (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/Package.html Mon Jan 29 17:48:32 2007
@@ -0,0 +1,5 @@
+<html><head></head>
+<body>
+Suggest alternate spellings for words.
+</body>
+</html>

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/PlainTextDictionary.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/SpellChecker.Net/Spell/PlainTextDictionary.cs?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/PlainTextDictionary.cs (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/PlainTextDictionary.cs Mon Jan 29 17:48:32 2007
@@ -0,0 +1,116 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+using System;
+
+namespace SpellChecker.Net.Search.Spell
+{
+	
+	
+    /// <summary> Dictionary represented by a file text.
+    /// 
+    /// <p>Format allowed: 1 word per line:<br>
+    /// word1<br>
+    /// word2<br>
+    /// word3<br>
+    /// 
+    /// </summary>
+    /// <author>  Nicolas Maisonneuve
+    /// </author>
+    public class PlainTextDictionary : Dictionary
+    {
+        virtual public System.Collections.IEnumerator GetWordsIterator()
+        {
+            return new FileIterator(this);
+        }
+		
+        private System.IO.StreamReader in_Renamed;
+        private System.String line;
+        private bool has_next_called;
+		
+        public PlainTextDictionary(System.IO.FileInfo file)
+        {
+            in_Renamed = new System.IO.StreamReader(new System.IO.StreamReader(file.FullName, System.Text.Encoding.Default).BaseStream, new System.IO.StreamReader(file.FullName, System.Text.Encoding.Default).CurrentEncoding);
+        }
+		
+        public PlainTextDictionary(System.IO.Stream dictFile)
+        {
+            in_Renamed = new System.IO.StreamReader(new System.IO.StreamReader(dictFile, System.Text.Encoding.Default).BaseStream, new System.IO.StreamReader(dictFile, System.Text.Encoding.Default).CurrentEncoding);
+        }
+		
+		
+        internal sealed class FileIterator : System.Collections.IEnumerator
+        {
+            public FileIterator(PlainTextDictionary enclosingInstance)
+            {
+                InitBlock(enclosingInstance);
+            }
+            private void  InitBlock(PlainTextDictionary enclosingInstance)
+            {
+                this.enclosingInstance = enclosingInstance;
+            }
+            private PlainTextDictionary enclosingInstance;
+            public System.Object Current
+            {
+                get
+                {
+                    if (!Enclosing_Instance.has_next_called)
+                    {
+                        MoveNext();
+                    }
+                    Enclosing_Instance.has_next_called = false;
+                    return Enclosing_Instance.line;
+                }
+				
+            }
+            public PlainTextDictionary Enclosing_Instance
+            {
+                get
+                {
+                    return enclosingInstance;
+                }
+				
+            }
+			
+			
+            public bool MoveNext()
+            {
+                Enclosing_Instance.has_next_called = true;
+                try
+                {
+                    Enclosing_Instance.line = Enclosing_Instance.in_Renamed.ReadLine();
+                }
+                catch (System.IO.IOException ex)
+                {
+                    System.Console.Error.WriteLine(ex.StackTrace);
+                    Enclosing_Instance.line = null;
+                    return false;
+                }
+                return (Enclosing_Instance.line != null)?true:false;
+            }
+			
+			
+            public void  Remove()
+            {
+            }
+			
+            public void  Reset()
+            {
+            }
+        }
+    }
+}
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/SpellChecker.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/SpellChecker.Net/Spell/SpellChecker.cs?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/SpellChecker.cs (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/SpellChecker.cs Mon Jan 29 17:48:32 2007
@@ -0,0 +1,395 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+using System;
+
+using WhitespaceAnalyzer = Lucene.Net.Analysis.WhitespaceAnalyzer;
+using Document = Lucene.Net.Documents.Document;
+using Field = Lucene.Net.Documents.Field;
+using IndexReader = Lucene.Net.Index.IndexReader;
+using IndexWriter = Lucene.Net.Index.IndexWriter;
+using Term = Lucene.Net.Index.Term;
+using BooleanClause = Lucene.Net.Search.BooleanClause;
+using BooleanQuery = Lucene.Net.Search.BooleanQuery;
+using Hits = Lucene.Net.Search.Hits;
+using IndexSearcher = Lucene.Net.Search.IndexSearcher;
+using Query = Lucene.Net.Search.Query;
+using TermQuery = Lucene.Net.Search.TermQuery;
+using Directory = Lucene.Net.Store.Directory;
+
+namespace SpellChecker.Net.Search.Spell
+{
+	
+	
+    /// <summary>  <p>
+    /// Spell Checker class  (Main class) <br/>
+    /// (initially inspired by the David Spencer code).
+    /// </p>
+    /// 
+    /// <p>Example Usage:
+    /// 
+    /// <pre>
+    /// SpellChecker spellchecker = new SpellChecker(spellIndexDirectory);
+    /// // To index a field of a user index:
+    /// spellchecker.indexDictionary(new LuceneDictionary(my_lucene_reader, a_field));
+    /// // To index a file containing words:
+    /// spellchecker.indexDictionary(new PlainTextDictionary(new File("myfile.txt")));
+    /// String[] suggestions = spellchecker.suggestSimilar("misspelt", 5);
+    /// </pre>
+    /// 
+    /// </summary>
+    /// <author>  Nicolas Maisonneuve
+    /// </author>
+    /// <version>  1.0
+    /// </version>
+    public class SpellChecker
+    {
+        virtual public void SetSpellIndex(Directory spellindex)
+        {
+            this.spellindex = spellindex;
+        }
+        /// <summary>  Set the accuracy 0 &lt; min &lt; 1; default 0.5</summary>
+        virtual public void SetAccuraty(float min)
+        {
+            this.min = min;
+        }
+		
+        /// <summary> Field name for each word in the ngram index.</summary>
+        public const System.String F_WORD = "word";
+		
+		
+        /// <summary> the spell index</summary>
+        internal Directory spellindex;
+		
+        /// <summary> Boost value for start and end grams</summary>
+        private float bStart = 2.0f;
+        private float bEnd = 1.0f;
+		
+		
+        private IndexReader reader;
+        internal float min = 0.5f;
+		
+		
+        public SpellChecker(Directory gramIndex)
+        {
+            this.SetSpellIndex(gramIndex);
+        }
+		
+		
+        /// <summary> Suggest similar words</summary>
+        /// <param name="word">String the word you want a spell check done on
+        /// </param>
+        /// <param name="num_sug">int the number of suggest words
+        /// </param>
+        /// <throws>  IOException </throws>
+        /// <returns> String[]
+        /// </returns>
+        public virtual System.String[] SuggestSimilar(System.String word, int num_sug)
+        {
+            return this.SuggestSimilar(word, num_sug, null, null, false);
+        }
+		
+		
+        /// <summary> Suggest similar words (restricted or not to a field of a user index)</summary>
+        /// <param name="word">String the word you want a spell check done on
+        /// </param>
+        /// <param name="num_sug">int the number of suggest words
+        /// </param>
+        /// <param name="ir">the indexReader of the user index (can be null see field param)
+        /// </param>
+        /// <param name="field">String the field of the user index: if field is not null, the suggested
+        /// words are restricted to the words present in this field.
+        /// </param>
+        /// <param name="morePopular">boolean return only the suggest words that are more frequent than the searched word
+        /// (only if restricted mode = (indexReader!=null and field!=null)
+        /// </param>
+        /// <throws>  IOException </throws>
+        /// <returns> String[] the sorted list of the suggest words with this 2 criteria:
+        /// first criteria: the edit distance, second criteria (only if restricted mode): the popularity
+        /// of the suggest words in the field of the user index
+        /// </returns>
+        public virtual System.String[] SuggestSimilar(System.String word, int num_sug, IndexReader ir, System.String field, bool morePopular)
+        {
+			
+            TRStringDistance sd = new TRStringDistance(word);
+            int lengthWord = word.Length;
+			
+            int goalFreq = (morePopular && ir != null) ? ir.DocFreq(new Term(field, word)) : 0;
+            if (!morePopular && goalFreq > 0)
+            {
+                return new System.String[]{word}; // return the word if it exist in the index and i don't want a more popular word
+            }
+			
+            BooleanQuery query = new BooleanQuery();
+            System.String[] grams;
+            System.String key;
+			
+            for (int ng = GetMin(lengthWord); ng <= GetMax(lengthWord); ng++)
+            {
+				
+                key = "gram" + ng; // form key
+				
+                grams = FormGrams(word, ng); // form word into ngrams (allow dups too)
+				
+                if (grams.Length == 0)
+                {
+                    continue; // hmm
+                }
+				
+                if (bStart > 0)
+                {
+                    // should we boost prefixes?
+                    Add(query, "start" + ng, grams[0], bStart); // matches start of word
+                }
+                if (bEnd > 0)
+                {
+                    // should we boost suffixes
+                    Add(query, "end" + ng, grams[grams.Length - 1], bEnd); // matches end of word
+                }
+                for (int i = 0; i < grams.Length; i++)
+                {
+                    Add(query, key, grams[i]);
+                }
+            }
+			
+            IndexSearcher searcher = new IndexSearcher(this.spellindex);
+            Hits hits = searcher.Search(query);
+            SuggestWordQueue sugqueue = new SuggestWordQueue(num_sug);
+			
+            int stop = Math.Min(hits.Length(), 10 * num_sug); // go thru more than 'maxr' matches in case the distance filter triggers
+            SuggestWord sugword = new SuggestWord();
+            for (int i = 0; i < stop; i++)
+            {
+				
+                sugword.string_Renamed = hits.Doc(i).Get(F_WORD); // get orig word)
+				
+                if (sugword.string_Renamed.Equals(word))
+                {
+                    continue; // don't suggest a word for itself, that would be silly
+                }
+				
+                //edit distance/normalize with the min word length
+                sugword.score = 1.0f - ((float) sd.GetDistance(sugword.string_Renamed) / System.Math.Min(sugword.string_Renamed.Length, lengthWord));
+                if (sugword.score < min)
+                {
+                    continue;
+                }
+				
+                if (ir != null)
+                {
+                    // use the user index
+                    sugword.freq = ir.DocFreq(new Term(field, sugword.string_Renamed)); // freq in the index
+                    if ((morePopular && goalFreq > sugword.freq) || sugword.freq < 1)
+                    {
+                        // don't suggest a word that is not present in the field
+                        continue;
+                    }
+                }
+                sugqueue.Insert(sugword);
+                if (sugqueue.Size() == num_sug)
+                {
+                    //if queue full , maintain the min score
+                    min = ((SuggestWord) sugqueue.Top()).score;
+                }
+                sugword = new SuggestWord();
+            }
+			
+            // convert to array string
+            System.String[] list = new System.String[sugqueue.Size()];
+            for (int i = sugqueue.Size() - 1; i >= 0; i--)
+            {
+                list[i] = ((SuggestWord) sugqueue.Pop()).string_Renamed;
+            }
+			
+            searcher.Close();
+            return list;
+        }
+		
+		
+        /// <summary> Add a clause to a boolean query.</summary>
+        private static void  Add(BooleanQuery q, System.String k, System.String v, float boost)
+        {
+            Query tq = new TermQuery(new Term(k, v));
+            tq.SetBoost(boost);
+            q.Add(new BooleanClause(tq, BooleanClause.Occur.SHOULD));
+        }
+		
+		
+        /// <summary> Add a clause to a boolean query.</summary>
+        private static void  Add(BooleanQuery q, System.String k, System.String v)
+        {
+            q.Add(new BooleanClause(new TermQuery(new Term(k, v)), BooleanClause.Occur.SHOULD));
+        }
+		
+		
+        /// <summary> Form all ngrams for a given word.</summary>
+        /// <param name="text">the word to parse
+        /// </param>
+        /// <param name="ng">the ngram length e.g. 3
+        /// </param>
+        /// <returns> an array of all ngrams in the word and note that duplicates are not removed
+        /// </returns>
+        private static System.String[] FormGrams(System.String text, int ng)
+        {
+            int len = text.Length;
+            System.String[] res = new System.String[len - ng + 1];
+            for (int i = 0; i < len - ng + 1; i++)
+            {
+                res[i] = text.Substring(i, (i + ng) - (i));
+            }
+            return res;
+        }
+		
+		
+        public virtual void  ClearIndex()
+        {
+            IndexReader.Unlock(spellindex);
+            IndexWriter writer = new IndexWriter(spellindex, null, true);
+            writer.Close();
+        }
+		
+		
+        /// <summary> Check whether the word exists in the index.</summary>
+        /// <param name="word">String
+        /// </param>
+        /// <throws>  IOException </throws>
+        /// <returns> true iff the word exists in the index
+        /// </returns>
+        public virtual bool Exist(System.String word)
+        {
+            if (reader == null)
+            {
+                reader = IndexReader.Open(spellindex);
+            }
+            return reader.DocFreq(new Term(F_WORD, word)) > 0;
+        }
+		
+		
+        /// <summary> Index a Dictionary</summary>
+        /// <param name="dict">the dictionary to index
+        /// </param>
+        /// <throws>  IOException </throws>
+        public virtual void  IndexDictionary(Dictionary dict)
+        {
+            IndexReader.Unlock(spellindex);
+            IndexWriter writer = new IndexWriter(spellindex, new WhitespaceAnalyzer(), !IndexReader.IndexExists(spellindex));
+            writer.SetMergeFactor(300);
+            writer.SetMaxBufferedDocs(150);
+			
+            System.Collections.IEnumerator iter = dict.GetWordsIterator();
+            while (iter.MoveNext())
+            {
+                System.String word = (System.String) iter.Current;
+				
+                int len = word.Length;
+                if (len < 3)
+                {
+                    continue; // too short we bail but "too long" is fine...
+                }
+				
+                if (this.Exist(word))
+                {
+                    // if the word already exist in the gramindex
+                    continue;
+                }
+				
+                // ok index the word
+                Document doc = CreateDocument(word, GetMin(len), GetMax(len));
+                writer.AddDocument(doc);
+            }
+            // close writer
+            writer.Optimize();
+            writer.Close();
+			
+            // close reader
+            reader.Close();
+            reader = null;
+        }
+		
+		
+        private int GetMin(int l)
+        {
+            if (l > 5)
+            {
+                return 3;
+            }
+            if (l == 5)
+            {
+                return 2;
+            }
+            return 1;
+        }
+		
+		
+        private int GetMax(int l)
+        {
+            if (l > 5)
+            {
+                return 4;
+            }
+            if (l == 5)
+            {
+                return 3;
+            }
+            return 2;
+        }
+		
+		
+        private static Document CreateDocument(System.String text, int ng1, int ng2)
+        {
+            Document doc = new Document();
+            doc.Add(new Field(F_WORD, text, Field.Store.YES, Field.Index.UN_TOKENIZED)); // orig term
+            AddGram(text, doc, ng1, ng2);
+            return doc;
+        }
+		
+		
+        private static void  AddGram(System.String text, Document doc, int ng1, int ng2)
+        {
+            int len = text.Length;
+            for (int ng = ng1; ng <= ng2; ng++)
+            {
+                System.String key = "gram" + ng;
+                System.String end = null;
+                for (int i = 0; i < len - ng + 1; i++)
+                {
+                    System.String gram = text.Substring(i, (i + ng) - (i));
+                    doc.Add(new Field(key, gram, Field.Store.YES, Field.Index.UN_TOKENIZED));
+                    if (i == 0)
+                    {
+                        doc.Add(new Field("start" + ng, gram, Field.Store.YES, Field.Index.UN_TOKENIZED));
+                    }
+                    end = gram;
+                }
+                if (end != null)
+                {
+                    // may not be present if len==ng1
+                    doc.Add(new Field("end" + ng, end, Field.Store.YES, Field.Index.UN_TOKENIZED));
+                }
+            }
+        }
+		
+		
+        ~SpellChecker()
+        {
+            if (reader != null)
+            {
+                reader.Close();
+            }
+        }
+    }
+}
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/SuggestWord.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/SpellChecker.Net/Spell/SuggestWord.cs?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/SuggestWord.cs (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/SuggestWord.cs Mon Jan 29 17:48:32 2007
@@ -0,0 +1,68 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+using System;
+
+namespace SpellChecker.Net.Search.Spell
+{
+	
+    /// <summary>  SuggestWord Class, used in suggestSimilar method in SpellChecker class.
+    /// 
+    /// </summary>
+    /// <author>  Nicolas Maisonneuve
+    /// </author>
+    sealed class SuggestWord
+    {
+        /// <summary> the score of the word</summary>
+        public float score;
+		
+		
+        /// <summary> The freq of the word</summary>
+        public int freq;
+		
+		
+        /// <summary> the suggested word</summary>
+        public System.String string_Renamed;
+		
+		
+        public int CompareTo(SuggestWord a)
+        {
+            //first criteria: the edit distance
+            if (score > a.score)
+            {
+                return 1;
+            }
+            if (score < a.score)
+            {
+                return - 1;
+            }
+			
+            //second criteria (if first criteria is equal): the popularity
+            if (freq > a.freq)
+            {
+                return 1;
+            }
+			
+            if (freq < a.freq)
+            {
+                return - 1;
+            }
+			
+            return 0;
+        }
+    }
+}
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/SuggestWordQueue.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/SpellChecker.Net/Spell/SuggestWordQueue.cs?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/SuggestWordQueue.cs (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/SuggestWordQueue.cs Mon Jan 29 17:48:32 2007
@@ -0,0 +1,41 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+using System;
+using PriorityQueue = Lucene.Net.Util.PriorityQueue;
+
+namespace SpellChecker.Net.Search.Spell
+{
+	
+	
+    sealed class SuggestWordQueue : PriorityQueue
+    {
+		
+        internal SuggestWordQueue(int size)
+        {
+            Initialize(size);
+        }
+		
+        override public bool LessThan(System.Object a, System.Object b)
+        {
+            SuggestWord wa = (SuggestWord) a;
+            SuggestWord wb = (SuggestWord) b;
+            int val = wa.CompareTo(wb);
+            return val < 0;
+        }
+    }
+}
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/TRStringDistance.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/SpellChecker.Net/Spell/TRStringDistance.cs?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/TRStringDistance.cs (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/Spell/TRStringDistance.cs Mon Jan 29 17:48:32 2007
@@ -0,0 +1,148 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+using System;
+
+namespace SpellChecker.Net.Search.Spell
+{
+	
+    /// <summary> Edit distance  class</summary>
+    sealed class TRStringDistance
+    {
+		
+        internal char[] sa;
+        internal int n;
+        internal int[][][] cache = new int[30][][];
+		
+		
+        /// <summary> Optimized to run a bit faster than the static getDistance().
+        /// In one benchmark times were 5.3sec using ctr vs 8.5sec w/ static method, thus 37% faster.
+        /// </summary>
+        public TRStringDistance(System.String target)
+        {
+            sa = target.ToCharArray();
+            n = sa.Length;
+        }
+		
+		
+        //*****************************
+        // Compute Levenshtein distance
+        //*****************************
+        public int GetDistance(System.String other)
+        {
+            int[][] d; // matrix
+            int cost; // cost
+			
+            // Step 1
+            char[] ta = other.ToCharArray();
+            int m = ta.Length;
+            if (n == 0)
+            {
+                return m;
+            }
+            if (m == 0)
+            {
+                return n;
+            }
+			
+            if (m >= cache.Length)
+            {
+                d = Form(n, m);
+            }
+            else if (cache[m] != null)
+            {
+                d = cache[m];
+            }
+            else
+            {
+                d = cache[m] = Form(n, m);
+				
+                // Step 3
+            }
+            for (int i = 1; i <= n; i++)
+            {
+                char s_i = sa[i - 1];
+				
+                // Step 4
+				
+                for (int j = 1; j <= m; j++)
+                {
+                    char t_j = ta[j - 1];
+					
+                    // Step 5
+					
+                    if (s_i == t_j)
+                    {
+                        // same
+                        cost = 0;
+                    }
+                    else
+                    {
+                        // not a match
+                        cost = 1;
+						
+                        // Step 6
+                    }
+                    d[i][j] = Min3(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
+                }
+            }
+			
+            // Step 7
+            return d[n][m];
+        }
+		
+		
+        /// <summary> </summary>
+        private static int[][] Form(int n, int m)
+        {
+            int[][] d = new int[n + 1][];
+            for (int i = 0; i < n + 1; i++)
+            {
+                d[i] = new int[m + 1];
+            }
+            // Step 2
+			
+            for (int i = 0; i <= n; i++)
+            {
+                d[i][0] = i;
+            }
+            for (int j = 0; j <= m; j++)
+            {
+                d[0][j] = j;
+            }
+            return d;
+        }
+		
+		
+        //****************************
+        // Get minimum of three values
+        //****************************
+        private static int Min3(int a, int b, int c)
+        {
+            int mi = a;
+            if (b < mi)
+            {
+                mi = b;
+            }
+            if (c < mi)
+            {
+                mi = c;
+            }
+            return mi;
+        }
+    }
+}
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/SpellChecker.Net-2.0.0.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/SpellChecker.Net/SpellChecker.Net-2.0.0.csproj?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/SpellChecker.Net-2.0.0.csproj (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/SpellChecker.Net-2.0.0.csproj Mon Jan 29 17:48:32 2007
@@ -0,0 +1,160 @@
+<VisualStudioProject>
+    <CSHARP
+        ProjectType = "Local"
+        ProductVersion = "7.10.3077"
+        SchemaVersion = "2.0"
+        ProjectGuid = "{FF45EE91-9CA3-443D-8231-75E9FA1AF40E}"
+    >
+        <Build>
+            <Settings
+                ApplicationIcon = ""
+                AssemblyKeyContainerName = ""
+                AssemblyName = "SpellChecker.Net"
+                AssemblyOriginatorKeyFile = ""
+                DefaultClientScript = "JScript"
+                DefaultHTMLPageLayout = "Grid"
+                DefaultTargetSchema = "IE50"
+                DelaySign = "false"
+                OutputType = "Library"
+                PreBuildEvent = ""
+                PostBuildEvent = ""
+                RootNamespace = "SpellChecker.Net"
+                RunPostBuildEvent = "OnBuildSuccess"
+                StartupObject = ""
+            >
+                <Config
+                    Name = "Debug"
+                    AllowUnsafeBlocks = "false"
+                    BaseAddress = "285212672"
+                    CheckForOverflowUnderflow = "false"
+                    ConfigurationOverrideFile = ""
+                    DefineConstants = "DEBUG;TRACE"
+                    DocumentationFile = "SpellChecker.Net.xml"
+                    DebugSymbols = "true"
+                    FileAlignment = "4096"
+                    IncrementalBuild = "true"
+                    NoStdLib = "false"
+                    NoWarn = ""
+                    Optimize = "false"
+                    OutputPath = "bin\Debug\"
+                    RegisterForComInterop = "false"
+                    RemoveIntegerChecks = "false"
+                    TreatWarningsAsErrors = "false"
+                    WarningLevel = "4"
+                />
+                <Config
+                    Name = "Release"
+                    AllowUnsafeBlocks = "false"
+                    BaseAddress = "285212672"
+                    CheckForOverflowUnderflow = "false"
+                    ConfigurationOverrideFile = ""
+                    DefineConstants = "TRACE"
+                    DocumentationFile = "SpellChecker.Net.xml"
+                    DebugSymbols = "false"
+                    FileAlignment = "4096"
+                    IncrementalBuild = "false"
+                    NoStdLib = "false"
+                    NoWarn = ""
+                    Optimize = "true"
+                    OutputPath = "bin\Release\"
+                    RegisterForComInterop = "false"
+                    RemoveIntegerChecks = "false"
+                    TreatWarningsAsErrors = "false"
+                    WarningLevel = "4"
+                />
+            </Settings>
+            <References>
+                <Reference
+                    Name = "System"
+                    AssemblyName = "System"
+                />
+                <Reference
+                    Name = "System.Data"
+                    AssemblyName = "System.Data"
+                />
+                <Reference
+                    Name = "System.Drawing"
+                    AssemblyName = "System.Drawing"
+                />
+                <Reference
+                    Name = "System.Management"
+                    AssemblyName = "System.Management"
+                />
+                <Reference
+                    Name = "System.Windows.Forms"
+                    AssemblyName = "System.Windows.Forms"
+                />
+                <Reference
+                    Name = "System.Design"
+                    AssemblyName = "System.Design"
+                />
+                <Reference
+                    Name = "System.Xml"
+                    AssemblyName = "System.Xml"
+                />
+                <Reference
+                    Name = "mscorlib"
+                    AssemblyName = "mscorlib"
+                />
+                <Reference
+                    Name = "Lucene.Net"
+                    AssemblyName = "Lucene.Net"
+                    HintPath = "Lucene.Net.dll"
+                />
+            </References>
+        </Build>
+        <Files>
+            <Include>
+                <File
+                    RelPath = "AssemblyInfo.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Build.xml"
+                    BuildAction = "Content"
+                />
+                <File
+                    RelPath = "Spell\Dictionary.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Spell\LuceneDictionary.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Spell\Package.html"
+                    BuildAction = "Content"
+                />
+                <File
+                    RelPath = "Spell\PlainTextDictionary.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Spell\SpellChecker.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Spell\SuggestWord.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Spell\SuggestWordQueue.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Spell\TRStringDistance.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+            </Include>
+        </Files>
+    </CSHARP>
+</VisualStudioProject>
+

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/SpellChecker.Net.sln
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/SpellChecker.Net/SpellChecker.Net.sln?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/SpellChecker.Net.sln (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/SpellChecker.Net/SpellChecker.Net.sln Mon Jan 29 17:48:32 2007
@@ -0,0 +1,24 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpellChecker.Net-2.0.0", "SpellChecker.Net-2.0.0.csproj", "{FF45EE91-9CA3-443D-8231-75E9FA1AF40E}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(DPCodeReviewSolutionGUID) = preSolution
+		DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
+	EndGlobalSection
+	GlobalSection(SolutionConfiguration) = preSolution
+		Debug = Debug
+		Release = Release
+	EndGlobalSection
+	GlobalSection(ProjectConfiguration) = postSolution
+		{FF45EE91-9CA3-443D-8231-75E9FA1AF40E}.Debug.ActiveCfg = Debug|.NET
+		{FF45EE91-9CA3-443D-8231-75E9FA1AF40E}.Debug.Build.0 = Debug|.NET
+		{FF45EE91-9CA3-443D-8231-75E9FA1AF40E}.Release.ActiveCfg = Release|.NET
+		{FF45EE91-9CA3-443D-8231-75E9FA1AF40E}.Release.Build.0 = Release|.NET
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+	EndGlobalSection
+	GlobalSection(ExtensibilityAddIns) = postSolution
+	EndGlobalSection
+EndGlobal

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/Test/AssemblyInfo.cs?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/AssemblyInfo.cs (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/AssemblyInfo.cs Mon Jan 29 17:48:32 2007
@@ -0,0 +1,58 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+//
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly: AssemblyTitle("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]		
+
+//
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers 
+// by using the '*' as shown below:
+
+[assembly: AssemblyVersion("2.0.0.1")]
+
+//
+// In order to sign your assembly you must specify a key to use. Refer to the 
+// Microsoft .NET Framework documentation for more information on assembly signing.
+//
+// Use the attributes below to control which key is used for signing. 
+//
+// Notes: 
+//   (*) If no key is specified, the assembly is not signed.
+//   (*) KeyName refers to a key that has been installed in the Crypto Service
+//       Provider (CSP) on your machine. KeyFile refers to a file which contains
+//       a key.
+//   (*) If the KeyFile and the KeyName values are both specified, the 
+//       following processing occurs:
+//       (1) If the KeyName can be found in the CSP, that key is used.
+//       (2) If the KeyName does not exist and the KeyFile does exist, the key 
+//           in the KeyFile is installed into the CSP and used.
+//   (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
+//       When specifying the KeyFile, the location of the KeyFile should be
+//       relative to the project output directory which is
+//       %Project Directory%\obj\<configuration>. For example, if your KeyFile is
+//       located in the project directory, you would specify the AssemblyKeyFile 
+//       attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
+//   (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+//       documentation for more information on this.
+//
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
+[assembly: AssemblyKeyName("")]

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/SpellChecker.Net.Test-2.0.0.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/Test/SpellChecker.Net.Test-2.0.0.csproj?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/SpellChecker.Net.Test-2.0.0.csproj (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/SpellChecker.Net.Test-2.0.0.csproj Mon Jan 29 17:48:32 2007
@@ -0,0 +1,127 @@
+<VisualStudioProject>
+    <CSHARP
+        ProjectType = "Local"
+        ProductVersion = "7.10.3077"
+        SchemaVersion = "2.0"
+        ProjectGuid = "{4DCB81AA-ECC1-4B3D-A0C9-28E54F5B125C}"
+    >
+        <Build>
+            <Settings
+                ApplicationIcon = ""
+                AssemblyKeyContainerName = ""
+                AssemblyName = "SpellChecker.Net.Test"
+                AssemblyOriginatorKeyFile = ""
+                DefaultClientScript = "JScript"
+                DefaultHTMLPageLayout = "Grid"
+                DefaultTargetSchema = "IE50"
+                DelaySign = "false"
+                OutputType = "Library"
+                PreBuildEvent = ""
+                PostBuildEvent = ""
+                RootNamespace = "SpellChecker.Net.Test"
+                RunPostBuildEvent = "OnBuildSuccess"
+                StartupObject = ""
+            >
+                <Config
+                    Name = "Debug"
+                    AllowUnsafeBlocks = "false"
+                    BaseAddress = "285212672"
+                    CheckForOverflowUnderflow = "false"
+                    ConfigurationOverrideFile = ""
+                    DefineConstants = "DEBUG;TRACE"
+                    DocumentationFile = ""
+                    DebugSymbols = "true"
+                    FileAlignment = "4096"
+                    IncrementalBuild = "true"
+                    NoStdLib = "false"
+                    NoWarn = ""
+                    Optimize = "false"
+                    OutputPath = "bin\Debug\"
+                    RegisterForComInterop = "false"
+                    RemoveIntegerChecks = "false"
+                    TreatWarningsAsErrors = "false"
+                    WarningLevel = "4"
+                />
+                <Config
+                    Name = "Release"
+                    AllowUnsafeBlocks = "false"
+                    BaseAddress = "285212672"
+                    CheckForOverflowUnderflow = "false"
+                    ConfigurationOverrideFile = ""
+                    DefineConstants = "TRACE"
+                    DocumentationFile = ""
+                    DebugSymbols = "false"
+                    FileAlignment = "4096"
+                    IncrementalBuild = "false"
+                    NoStdLib = "false"
+                    NoWarn = ""
+                    Optimize = "true"
+                    OutputPath = "bin\Release\"
+                    RegisterForComInterop = "false"
+                    RemoveIntegerChecks = "false"
+                    TreatWarningsAsErrors = "false"
+                    WarningLevel = "4"
+                />
+            </Settings>
+            <References>
+                <Reference
+                    Name = "System"
+                    AssemblyName = "System"
+                    HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
+                />
+                <Reference
+                    Name = "System.Data"
+                    AssemblyName = "System.Data"
+                    HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
+                />
+                <Reference
+                    Name = "System.XML"
+                    AssemblyName = "System.XML"
+                    HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
+                />
+                <Reference
+                    Name = "SpellChecker.Net"
+                    AssemblyName = "SpellChecker.Net"
+                    HintPath = "..\SpellChecker.Net\bin\Debug\SpellChecker.Net.dll"
+                />
+                <Reference
+                    Name = "Lucene.Net"
+                    AssemblyName = "Lucene.Net"
+                    HintPath = "..\..\Lucene.Net-2.0.1-001.src\Lucene.Net\bin\Debug\Lucene.Net.dll"
+                />
+                <Reference
+                    Name = "nunit.framework"
+                    AssemblyName = "nunit.framework"
+                    HintPath = "D:\DEVS\NUnit\bin\nunit.framework.dll"
+                    AssemblyFolderKey = "hklm\dn\nunit.framework"
+                />
+                <Reference
+                    Name = "nunit.core"
+                    AssemblyName = "nunit.core"
+                    HintPath = "D:\DEVS\NUnit\bin\nunit.core.dll"
+                    AssemblyFolderKey = "hklm\dn\nunit.framework"
+                />
+            </References>
+        </Build>
+        <Files>
+            <Include>
+                <File
+                    RelPath = "AssemblyInfo.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Test\TestSpellChecker.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Util\English.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+            </Include>
+        </Files>
+    </CSHARP>
+</VisualStudioProject>
+

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/SpellChecker.Net.Test.nunit
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/Test/SpellChecker.Net.Test.nunit?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/SpellChecker.Net.Test.nunit (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/SpellChecker.Net.Test.nunit Mon Jan 29 17:48:32 2007
@@ -0,0 +1,9 @@
+<NUnitProject>
+  <Settings activeconfig="Debug" />
+  <Config name="Debug" binpathtype="Auto">
+    <assembly path="bin\Debug\SpellChecker.Net.Test.dll" />
+  </Config>
+  <Config name="Release" binpathtype="Auto">
+    <assembly path="bin\Release\SpellChecker.Net.Test.dll" />
+  </Config>
+</NUnitProject>
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/SpellChecker.Net.Test.sln
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/Test/SpellChecker.Net.Test.sln?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/SpellChecker.Net.Test.sln (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/SpellChecker.Net.Test.sln Mon Jan 29 17:48:32 2007
@@ -0,0 +1,24 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpellChecker.Net.Test-2.0.0", "SpellChecker.Net.Test-2.0.0.csproj", "{4DCB81AA-ECC1-4B3D-A0C9-28E54F5B125C}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(DPCodeReviewSolutionGUID) = preSolution
+		DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
+	EndGlobalSection
+	GlobalSection(SolutionConfiguration) = preSolution
+		Debug = Debug
+		Release = Release
+	EndGlobalSection
+	GlobalSection(ProjectConfiguration) = postSolution
+		{4DCB81AA-ECC1-4B3D-A0C9-28E54F5B125C}.Debug.ActiveCfg = Debug|.NET
+		{4DCB81AA-ECC1-4B3D-A0C9-28E54F5B125C}.Debug.Build.0 = Debug|.NET
+		{4DCB81AA-ECC1-4B3D-A0C9-28E54F5B125C}.Release.ActiveCfg = Release|.NET
+		{4DCB81AA-ECC1-4B3D-A0C9-28E54F5B125C}.Release.Build.0 = Release|.NET
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+	EndGlobalSection
+	GlobalSection(ExtensibilityAddIns) = postSolution
+	EndGlobalSection
+EndGlobal

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/Test/TestSpellChecker.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/Test/Test/TestSpellChecker.cs?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/Test/TestSpellChecker.cs (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/Test/TestSpellChecker.cs Mon Jan 29 17:48:32 2007
@@ -0,0 +1,145 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+using System;
+
+using NUnit.Framework;
+
+using RAMDirectory = Lucene.Net.Store.RAMDirectory;
+using IndexWriter = Lucene.Net.Index.IndexWriter;
+using SimpleAnalyzer = Lucene.Net.Analysis.SimpleAnalyzer;
+using Document = Lucene.Net.Documents.Document;
+using English = Lucene.Net.Test.Util.Spell.English;
+using Field = Lucene.Net.Documents.Field;
+using IndexReader = Lucene.Net.Index.IndexReader;
+using Directory = Lucene.Net.Store.Directory;
+using LuceneDictionary = SpellChecker.Net.Search.Spell.LuceneDictionary;
+
+namespace SpellChecker.Net.Test.Search.Spell
+{
+	
+	
+	/// <summary> Test case
+	/// 
+	/// </summary>
+	/// <author>  Nicolas Maisonneuve
+	/// </author>
+	[TestFixture]
+    public class TestSpellChecker
+	{
+		private SpellChecker.Net.Search.Spell.SpellChecker spellChecker;
+		private Directory userindex, spellindex;
+		
+        [SetUp]
+        public virtual void  SetUp()
+		{
+			//create a user index
+			userindex = new RAMDirectory();
+			IndexWriter writer = new IndexWriter(userindex, new SimpleAnalyzer(), true);
+			
+			for (int i = 0; i < 1000; i++)
+			{
+				Document doc = new Document();
+				doc.Add(new Field("field1", English.IntToEnglish(i), Field.Store.YES, Field.Index.TOKENIZED));
+				doc.Add(new Field("field2", English.IntToEnglish(i + 1), Field.Store.YES, Field.Index.TOKENIZED)); // + word thousand
+				writer.AddDocument(doc);
+			}
+			writer.Close();
+			
+			// create the spellChecker
+			spellindex = new RAMDirectory();
+			spellChecker = new SpellChecker.Net.Search.Spell.SpellChecker(spellindex);
+		}
+		
+		[Test]
+		public virtual void  TestBuild()
+		{
+			try
+			{
+				IndexReader r = IndexReader.Open(userindex);
+				
+				spellChecker.ClearIndex();
+				
+				Addwords(r, "field1");
+				int num_field1 = this.Numdoc();
+				
+				Addwords(r, "field2");
+				int num_field2 = this.Numdoc();
+				
+				Assert.AreEqual(num_field2, num_field1 + 1);
+				
+				// test small word
+				System.String[] similar = spellChecker.SuggestSimilar("fvie", 2);
+				Assert.AreEqual(1, similar.Length);
+				Assert.AreEqual(similar[0], "five");
+				
+				similar = spellChecker.SuggestSimilar("five", 2);
+				Assert.AreEqual(1, similar.Length);
+				Assert.AreEqual(similar[0], "nine"); // don't suggest a word for itself
+				
+				similar = spellChecker.SuggestSimilar("fiv", 2);
+				Assert.AreEqual(1, similar.Length);
+				Assert.AreEqual(similar[0], "five");
+				
+				similar = spellChecker.SuggestSimilar("ive", 2);
+				Assert.AreEqual(1, similar.Length);
+				Assert.AreEqual(similar[0], "five");
+				
+				similar = spellChecker.SuggestSimilar("fives", 2);
+				Assert.AreEqual(1, similar.Length);
+				Assert.AreEqual(similar[0], "five");
+				
+				similar = spellChecker.SuggestSimilar("fie", 2);
+				Assert.AreEqual(1, similar.Length);
+				Assert.AreEqual(similar[0], "five");
+				
+				similar = spellChecker.SuggestSimilar("fi", 2);
+				Assert.AreEqual(0, similar.Length);
+				
+				// test restraint to a field
+				similar = spellChecker.SuggestSimilar("tousand", 10, r, "field1", false);
+				Assert.AreEqual(0, similar.Length); // there isn't the term thousand in the field field1
+				
+				similar = spellChecker.SuggestSimilar("tousand", 10, r, "field2", false);
+				Assert.AreEqual(1, similar.Length); // there is the term thousand in the field field2
+			}
+			catch (System.IO.IOException e)
+			{
+                System.Console.Error.WriteLine(e.StackTrace);
+				Assert.Fail();
+			}
+		}
+		
+		private void  Addwords(IndexReader r, System.String field)
+		{
+			long time = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
+			spellChecker.IndexDictionary(new LuceneDictionary(r, field));
+			time = (System.DateTime.Now.Ticks - 621355968000000000) / 10000 - time;
+			//System.out.println("time to build " + field + ": " + time);
+		}
+		
+		private int Numdoc()
+		{
+			IndexReader rs = IndexReader.Open(spellindex);
+			int num = rs.NumDocs();
+			Assert.IsTrue(num != 0);
+			//System.out.println("num docs: " + num);
+			rs.Close();
+			return num;
+		}
+	}
+}
\ No newline at end of file

Added: incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/Util/English.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/contrib/SpellChecker.Net/Test/Util/English.cs?view=auto&rev=501282
==============================================================================
--- incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/Util/English.cs (added)
+++ incubator/lucene.net/trunk/C#/contrib/SpellChecker.Net/Test/Util/English.cs Mon Jan 29 17:48:32 2007
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2004 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.
+ */
+
+using System;
+
+namespace Lucene.Net.Test.Util.Spell
+{
+	
+	
+	public class English
+	{
+		
+		public static System.String IntToEnglish(int i)
+		{
+			System.Text.StringBuilder result = new System.Text.StringBuilder();
+			IntToEnglish(i, result);
+			return result.ToString();
+		}
+		
+		public static void  IntToEnglish(int i, System.Text.StringBuilder result)
+		{
+			if (i == 0)
+			{
+				result.Append("zero");
+				return ;
+			}
+			if (i < 0)
+			{
+				result.Append("minus ");
+				i = - i;
+			}
+			if (i >= 1000000000)
+			{
+				// billions
+				IntToEnglish(i / 1000000000, result);
+				result.Append("billion, ");
+				i = i % 1000000000;
+			}
+			if (i >= 1000000)
+			{
+				// millions
+				IntToEnglish(i / 1000000, result);
+				result.Append("million, ");
+				i = i % 1000000;
+			}
+			if (i >= 1000)
+			{
+				// thousands
+				IntToEnglish(i / 1000, result);
+				result.Append("thousand, ");
+				i = i % 1000;
+			}
+			if (i >= 100)
+			{
+				// hundreds
+				IntToEnglish(i / 100, result);
+				result.Append("hundred ");
+				i = i % 100;
+			}
+			if (i >= 20)
+			{
+				switch (i / 10)
+				{
+					
+					case 9:  result.Append("ninety"); break;
+					
+					case 8:  result.Append("eighty"); break;
+					
+					case 7:  result.Append("seventy"); break;
+					
+					case 6:  result.Append("sixty"); break;
+					
+					case 5:  result.Append("fifty"); break;
+					
+					case 4:  result.Append("forty"); break;
+					
+					case 3:  result.Append("thirty"); break;
+					
+					case 2:  result.Append("twenty"); break;
+					}
+				i = i % 10;
+				if (i == 0)
+					result.Append(" ");
+				else
+					result.Append("-");
+			}
+			switch (i)
+			{
+				
+				case 19:  result.Append("nineteen "); break;
+				
+				case 18:  result.Append("eighteen "); break;
+				
+				case 17:  result.Append("seventeen "); break;
+				
+				case 16:  result.Append("sixteen "); break;
+				
+				case 15:  result.Append("fifteen "); break;
+				
+				case 14:  result.Append("fourteen "); break;
+				
+				case 13:  result.Append("thirteen "); break;
+				
+				case 12:  result.Append("twelve "); break;
+				
+				case 11:  result.Append("eleven "); break;
+				
+				case 10:  result.Append("ten "); break;
+				
+				case 9:  result.Append("nine "); break;
+				
+				case 8:  result.Append("eight "); break;
+				
+				case 7:  result.Append("seven "); break;
+				
+				case 6:  result.Append("six "); break;
+				
+				case 5:  result.Append("five "); break;
+				
+				case 4:  result.Append("four "); break;
+				
+				case 3:  result.Append("three "); break;
+				
+				case 2:  result.Append("two "); break;
+				
+				case 1:  result.Append("one "); break;
+				
+				case 0:  result.Append(""); break;
+				}
+		}
+		
+		[STAThread]
+		public static void  Main(System.String[] args)
+		{
+			System.Console.Out.WriteLine(IntToEnglish(System.Int32.Parse(args[0])));
+		}
+	}
+}
\ No newline at end of file



Mime
View raw message