You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/04/01 01:08:56 UTC
[03/62] [abbrv] lucenenet git commit: Deleted obsolete Contrib folder
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02362804/src/contrib/Snowball/SF/Snowball/Package.html
----------------------------------------------------------------------
diff --git a/src/contrib/Snowball/SF/Snowball/Package.html b/src/contrib/Snowball/SF/Snowball/Package.html
deleted file mode 100644
index c40e812..0000000
--- a/src/contrib/Snowball/SF/Snowball/Package.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!--
-
- 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.
-
--->
-
-<html>
-<body>
-Snowball system classes.
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02362804/src/contrib/Snowball/SF/Snowball/SnowballProgram.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Snowball/SF/Snowball/SnowballProgram.cs b/src/contrib/Snowball/SF/Snowball/SnowballProgram.cs
deleted file mode 100644
index 5f50f60..0000000
--- a/src/contrib/Snowball/SF/Snowball/SnowballProgram.cs
+++ /dev/null
@@ -1,518 +0,0 @@
-/*
- * 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 System.Text;
-
-namespace SF.Snowball
-{
- /// <summary>
- /// This is the rev 500 of the snowball SVN trunk,
- /// but modified:
- /// made abstract and introduced abstract method stem to avoid expensive reflection in filter class
- /// </summary>
- public abstract class SnowballProgram
- {
- protected internal SnowballProgram()
- {
- current = new System.Text.StringBuilder();
- SetCurrent("");
- }
-
- public abstract bool Stem();
-
- /// <summary> Set the current string.</summary>
- public virtual void SetCurrent(System.String value)
- {
- //// current.Replace(current.ToString(0, current.Length - 0), value_Renamed, 0, current.Length - 0);
- current.Remove(0, current.Length);
- current.Append(value);
- cursor = 0;
- limit = current.Length;
- limit_backward = 0;
- bra = cursor;
- ket = limit;
- }
-
- /// <summary> Get the current string.</summary>
- virtual public System.String GetCurrent()
- {
- string result = current.ToString();
- // Make a new StringBuffer. If we reuse the old one, and a user of
- // the library keeps a reference to the buffer returned (for example,
- // by converting it to a String in a way which doesn't force a copy),
- // the buffer size will not decrease, and we will risk wasting a large
- // amount of memory.
- // Thanks to Wolfram Esser for spotting this problem.
- current = new StringBuilder();
- return result;
- }
-
- // current string
- protected internal System.Text.StringBuilder current;
-
- protected internal int cursor;
- protected internal int limit;
- protected internal int limit_backward;
- protected internal int bra;
- protected internal int ket;
-
- protected internal virtual void copy_from(SnowballProgram other)
- {
- current = other.current;
- cursor = other.cursor;
- limit = other.limit;
- limit_backward = other.limit_backward;
- bra = other.bra;
- ket = other.ket;
- }
-
- protected internal virtual bool in_grouping(char[] s, int min, int max)
- {
- if (cursor >= limit)
- return false;
- char ch = current[cursor];
- if (ch > max || ch < min)
- return false;
- ch -= (char) (min);
- if ((s[ch >> 3] & (0x1 << (ch & 0x7))) == 0)
- return false;
- cursor++;
- return true;
- }
-
- protected internal virtual bool in_grouping_b(char[] s, int min, int max)
- {
- if (cursor <= limit_backward)
- return false;
- char ch = current[cursor - 1];
- if (ch > max || ch < min)
- return false;
- ch -= (char) (min);
- if ((s[ch >> 3] & (0x1 << (ch & 0x7))) == 0)
- return false;
- cursor--;
- return true;
- }
-
- protected internal virtual bool out_grouping(char[] s, int min, int max)
- {
- if (cursor >= limit)
- return false;
- char ch = current[cursor];
- if (ch > max || ch < min)
- {
- cursor++;
- return true;
- }
- ch -= (char) (min);
- if ((s[ch >> 3] & (0x1 << (ch & 0x7))) == 0)
- {
- cursor++;
- return true;
- }
- return false;
- }
-
- protected internal virtual bool out_grouping_b(char[] s, int min, int max)
- {
- if (cursor <= limit_backward)
- return false;
- char ch = current[cursor - 1];
- if (ch > max || ch < min)
- {
- cursor--;
- return true;
- }
- ch -= (char) (min);
- if ((s[ch >> 3] & (0x1 << (ch & 0x7))) == 0)
- {
- cursor--;
- return true;
- }
- return false;
- }
-
- protected internal virtual bool in_range(int min, int max)
- {
- if (cursor >= limit)
- return false;
- char ch = current[cursor];
- if (ch > max || ch < min)
- return false;
- cursor++;
- return true;
- }
-
- protected internal virtual bool in_range_b(int min, int max)
- {
- if (cursor <= limit_backward)
- return false;
- char ch = current[cursor - 1];
- if (ch > max || ch < min)
- return false;
- cursor--;
- return true;
- }
-
- protected internal virtual bool out_range(int min, int max)
- {
- if (cursor >= limit)
- return false;
- char ch = current[cursor];
- if (!(ch > max || ch < min))
- return false;
- cursor++;
- return true;
- }
-
- protected internal virtual bool out_range_b(int min, int max)
- {
- if (cursor <= limit_backward)
- return false;
- char ch = current[cursor - 1];
- if (!(ch > max || ch < min))
- return false;
- cursor--;
- return true;
- }
-
- protected internal virtual bool eq_s(int s_size, System.String s)
- {
- if (limit - cursor < s_size)
- return false;
- int i;
- for (i = 0; i != s_size; i++)
- {
- if (current[cursor + i] != s[i])
- return false;
- }
- cursor += s_size;
- return true;
- }
-
- protected internal virtual bool eq_s_b(int s_size, System.String s)
- {
- if (cursor - limit_backward < s_size)
- return false;
- int i;
- for (i = 0; i != s_size; i++)
- {
- if (current[cursor - s_size + i] != s[i])
- return false;
- }
- cursor -= s_size;
- return true;
- }
-
- protected internal virtual bool eq_v(System.Text.StringBuilder s)
- {
- return eq_s(s.Length, s.ToString());
- }
-
- protected internal virtual bool eq_v_b(System.Text.StringBuilder s)
- {
- return eq_s_b(s.Length, s.ToString());
- }
-
- protected internal virtual int find_among(Among[] v, int v_size)
- {
- int i = 0;
- int j = v_size;
-
- int c = cursor;
- int l = limit;
-
- int common_i = 0;
- int common_j = 0;
-
- bool first_key_inspected = false;
-
- while (true)
- {
- int k = i + ((j - i) >> 1);
- int diff = 0;
- int common = common_i < common_j?common_i:common_j; // smaller
- Among w = v[k];
- int i2;
- for (i2 = common; i2 < w.s_size; i2++)
- {
- if (c + common == l)
- {
- diff = - 1;
- break;
- }
- diff = current[c + common] - w.s[i2];
- if (diff != 0)
- break;
- common++;
- }
- if (diff < 0)
- {
- j = k;
- common_j = common;
- }
- else
- {
- i = k;
- common_i = common;
- }
- if (j - i <= 1)
- {
- if (i > 0)
- break; // v->s has been inspected
- if (j == i)
- break; // only one item in v
-
- // - but now we need to go round once more to get
- // v->s inspected. This looks messy, but is actually
- // the optimal approach.
-
- if (first_key_inspected)
- break;
- first_key_inspected = true;
- }
- }
- while (true)
- {
- Among w = v[i];
- if (common_i >= w.s_size)
- {
- cursor = c + w.s_size;
- if (w.method == null)
- return w.result;
- bool res;
- try
- {
- System.Object resobj = w.method.Invoke(w.methodobject, (System.Object[]) new System.Object[0]);
- // {{Aroush}} UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Object.toString' may return a different value. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1043_3"'
- res = resobj.ToString().Equals("true", StringComparison.InvariantCultureIgnoreCase);
- }
- catch (System.Reflection.TargetInvocationException)
- {
- res = false;
- // FIXME - debug message
- }
- catch (System.UnauthorizedAccessException)
- {
- res = false;
- // FIXME - debug message
- }
- cursor = c + w.s_size;
- if (res)
- return w.result;
- }
- i = w.substring_i;
- if (i < 0)
- return 0;
- }
- }
-
- // find_among_b is for backwards processing. Same comments apply
- protected internal virtual int find_among_b(Among[] v, int v_size)
- {
- int i = 0;
- int j = v_size;
-
- int c = cursor;
- int lb = limit_backward;
-
- int common_i = 0;
- int common_j = 0;
-
- bool first_key_inspected = false;
-
- while (true)
- {
- int k = i + ((j - i) >> 1);
- int diff = 0;
- int common = common_i < common_j?common_i:common_j;
- Among w = v[k];
- int i2;
- for (i2 = w.s_size - 1 - common; i2 >= 0; i2--)
- {
- if (c - common == lb)
- {
- diff = - 1;
- break;
- }
- diff = current[c - 1 - common] - w.s[i2];
- if (diff != 0)
- break;
- common++;
- }
- if (diff < 0)
- {
- j = k;
- common_j = common;
- }
- else
- {
- i = k;
- common_i = common;
- }
- if (j - i <= 1)
- {
- if (i > 0)
- break;
- if (j == i)
- break;
- if (first_key_inspected)
- break;
- first_key_inspected = true;
- }
- }
- while (true)
- {
- Among w = v[i];
- if (common_i >= w.s_size)
- {
- cursor = c - w.s_size;
- if (w.method == null)
- return w.result;
-
- bool res;
- try
- {
- System.Object resobj = w.method.Invoke(w.methodobject, (System.Object[]) new System.Object[0]);
- // {{Aroush}} UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Object.toString' may return a different value. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1043_3"'
- res = resobj.ToString().Equals("true", StringComparison.InvariantCultureIgnoreCase);
- }
- catch (System.Reflection.TargetInvocationException)
- {
- res = false;
- // FIXME - debug message
- }
- catch (System.UnauthorizedAccessException)
- {
- res = false;
- // FIXME - debug message
- }
- cursor = c - w.s_size;
- if (res)
- return w.result;
- }
- i = w.substring_i;
- if (i < 0)
- return 0;
- }
- }
-
- /* to replace chars between c_bra and c_ket in current by the
- * chars in s.
- */
- protected internal virtual int replace_s(int c_bra, int c_ket, System.String s)
- {
- int adjustment = s.Length - (c_ket - c_bra);
- if (current.Length > c_bra)
- current.Replace(current.ToString(c_bra, c_ket - c_bra), s, c_bra, c_ket - c_bra);
- else
- current.Append(s);
- limit += adjustment;
- if (cursor >= c_ket)
- cursor += adjustment;
- else if (cursor > c_bra)
- cursor = c_bra;
- return adjustment;
- }
-
- protected internal virtual void slice_check()
- {
- if (bra < 0 || bra > ket || ket > limit || limit > current.Length)
- // this line could be removed
- {
- System.Console.Error.WriteLine("faulty slice operation");
- // FIXME: report error somehow.
- /*
- fprintf(stderr, "faulty slice operation:\n");
- debug(z, -1, 0);
- exit(1);
- */
- }
- }
-
- protected internal virtual void slice_from(System.String s)
- {
- slice_check();
- replace_s(bra, ket, s);
- }
-
- protected internal virtual void slice_from(System.Text.StringBuilder s)
- {
- slice_from(s.ToString());
- }
-
- protected internal virtual void slice_del()
- {
- slice_from("");
- }
-
- protected internal virtual void insert(int c_bra, int c_ket, System.String s)
- {
- int adjustment = replace_s(c_bra, c_ket, s);
- if (c_bra <= bra)
- bra += adjustment;
- if (c_bra <= ket)
- ket += adjustment;
- }
-
- protected internal virtual void insert(int c_bra, int c_ket, System.Text.StringBuilder s)
- {
- insert(c_bra, c_ket, s.ToString());
- }
-
- /* Copy the slice into the supplied StringBuffer */
- protected internal virtual System.Text.StringBuilder slice_to(System.Text.StringBuilder s)
- {
- slice_check();
- int len = ket - bra;
- //// s.Replace(s.ToString(0, s.Length - 0), current.ToString(bra, ket), 0, s.Length - 0);
- s.Remove(0, s.Length);
- s.Append(current.ToString(bra, len));
- return s;
- }
-
- protected internal virtual System.Text.StringBuilder assign_to(System.Text.StringBuilder s)
- {
- //// s.Replace(s.ToString(0, s.Length - 0), current.ToString(0, limit), 0, s.Length - 0);
- s.Remove(0, s.Length);
- s.Append(current.ToString(0, limit));
- return s;
- }
-
- /*
- extern void debug(struct SN_env * z, int number, int line_count)
- { int i;
- int limit = SIZE(z->p);
- //if (number >= 0) printf("%3d (line %4d): '", number, line_count);
- if (number >= 0) printf("%3d (line %4d): [%d]'", number, line_count,limit);
- for (i = 0; i <= limit; i++)
- { if (z->lb == i) printf("{");
- if (z->bra == i) printf("[");
- if (z->c == i) printf("|");
- if (z->ket == i) printf("]");
- if (z->l == i) printf("}");
- if (i < limit)
- { int ch = z->p[i];
- if (ch == 0) ch = '#';
- printf("%c", ch);
- }
- }
- printf("'\n");
- }*/
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02362804/src/contrib/Snowball/SF/Snowball/TestApp.cs
----------------------------------------------------------------------
diff --git a/src/contrib/Snowball/SF/Snowball/TestApp.cs b/src/contrib/Snowball/SF/Snowball/TestApp.cs
deleted file mode 100644
index 8c32681..0000000
--- a/src/contrib/Snowball/SF/Snowball/TestApp.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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 SF.Snowball
-{
-
- public class TestApp
- {
- [STAThread]
- public static void Main(System.String[] args)
- {
-
- if (args.Length < 2)
- {
- ExitWithUsage();
- }
-
- System.Type stemClass = System.Type.GetType("SF.Snowball.Ext." + args[0] + "Stemmer");
- SnowballProgram stemmer = (SnowballProgram) System.Activator.CreateInstance(stemClass);
- System.Reflection.MethodInfo stemMethod = stemClass.GetMethod("Stem", new Type[0]);
-
- System.IO.StreamReader reader;
- reader = new System.IO.StreamReader(new System.IO.FileStream(args[1], System.IO.FileMode.Open, System.IO.FileAccess.Read), System.Text.Encoding.Default);
- reader = new System.IO.StreamReader(reader.BaseStream, reader.CurrentEncoding);
-
- System.Text.StringBuilder input = new System.Text.StringBuilder();
-
- System.IO.Stream outstream = System.Console.OpenStandardOutput();
-
- if (args.Length > 2 && args[2].Equals("-o"))
- {
- outstream = new System.IO.FileStream(args[3], System.IO.FileMode.Create);
- }
- else if (args.Length > 2)
- {
- ExitWithUsage();
- }
-
- System.IO.StreamWriter output = new System.IO.StreamWriter(outstream, System.Text.Encoding.Default);
- output = new System.IO.StreamWriter(output.BaseStream, output.Encoding);
-
- int repeat = 1;
- if (args.Length > 4)
- {
- repeat = System.Int32.Parse(args[4]);
- }
-
- System.Object[] emptyArgs = new System.Object[0];
- int character;
- while ((character = reader.Read()) != - 1)
- {
- char ch = (char) character;
- if (System.Char.IsWhiteSpace(ch))
- {
- if (input.Length > 0)
- {
- stemmer.SetCurrent(input.ToString());
- for (int i = repeat; i != 0; i--)
- {
- stemMethod.Invoke(stemmer, (System.Object[]) emptyArgs);
- }
- output.Write(stemmer.GetCurrent());
- output.Write('\n');
- input.Remove(0, input.Length - 0);
- }
- }
- else
- {
- input.Append(System.Char.ToLower(ch));
- }
- }
- output.Flush();
- }
-
- private static void ExitWithUsage()
- {
- System.Console.Error.WriteLine("Usage: TestApp <stemmer name> <input file> [-o <output file>]");
- System.Environment.Exit(1);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02362804/src/contrib/Snowball/Xdocs/Index.xml
----------------------------------------------------------------------
diff --git a/src/contrib/Snowball/Xdocs/Index.xml b/src/contrib/Snowball/Xdocs/Index.xml
deleted file mode 100644
index 8b8fdcb..0000000
--- a/src/contrib/Snowball/Xdocs/Index.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-<!--
-
- 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.
-
--->
-
-<document>
-<properties>
-<author email="cutting@apache.org">Doug Cutting</author>
-<title>Overview - Snowball Stemmers for Lucene</title>
-</properties>
-<body>
-
-<section name="Snowball Stemmers for Lucene">
-<p>
-This project provides pre-compiled version of the Snowball stemmers
-together with classes integrating them with the Lucene search engine.
-</p>
-</section>
-
-<section name="Download">
-<p>
-Releases of the stemmers are available
-<a href="http://jakarta.apache.org/builds/jakarta-lucene-sandbox/snowball/">
-here</a>
-</p>
-</section>
-
-</body>
-</document>
-
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02362804/src/contrib/Snowball/Xdocs/Stylesheets/Project.xml
----------------------------------------------------------------------
diff --git a/src/contrib/Snowball/Xdocs/Stylesheets/Project.xml b/src/contrib/Snowball/Xdocs/Stylesheets/Project.xml
deleted file mode 100644
index 84d624f..0000000
--- a/src/contrib/Snowball/Xdocs/Stylesheets/Project.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-
- 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.
-
--->
-
-<project name="Snowball Stemers for Lucene"
- href="http://jakarta.apache.org/lucene-sandbox/snowball/">
-
- <title>Snowball Stemmers for Lucene</title>
-
- <body>
- <menu name="Documentation">
- <item name="Javadoc" href="/api/index.html"/>
- </menu>
-
- <menu name="Download">
- <item name="Releases"
- href="http://jakarta.apache.org/builds/jakarta-lucene-sandbox/snowball/"/>
- <item name="CVS Repository" href="/site/cvsindex.html"/>
- </menu>
-
- <menu name="Links">
- <item name="Snowball Home" href="http://snowball.tartarus.org/"/>
- <item name="Lucene Home" href="http://jakarta.apache.org/lucene/"/>
- <item name="Lucene Sandbox"
- href="http://jakarta.apache.org/lucene/docs/lucene-sandbox/"/>
- </menu>
-
- <menu name="Jakarta">
- <item name="Get Involved" href="/site/getinvolved.html"/>
- <item name="Acknowledgements" href="/site/acknowledgements.html"/>
- <item name="Contact" href="/site/contact.html"/>
- <item name="Legal" href="/site/legal.html"/>
- </menu>
- </body>
-</project>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02362804/src/contrib/SpellChecker/ABOUT.txt
----------------------------------------------------------------------
diff --git a/src/contrib/SpellChecker/ABOUT.txt b/src/contrib/SpellChecker/ABOUT.txt
deleted file mode 100644
index ae0f07b..0000000
--- a/src/contrib/SpellChecker/ABOUT.txt
+++ /dev/null
@@ -1 +0,0 @@
-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/
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02362804/src/contrib/SpellChecker/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/src/contrib/SpellChecker/AssemblyInfo.cs b/src/contrib/SpellChecker/AssemblyInfo.cs
deleted file mode 100644
index f1c5eb3..0000000
--- a/src/contrib/SpellChecker/AssemblyInfo.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *
- * 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.Reflection;
-using System.Runtime.CompilerServices;
-using System.Security;
-
-// 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("Apache Lucene.Net (SpellChecker)")]
-[assembly: AssemblyDescription("The Apache Software Foundation Lucene.Net a full-text search engine library")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("The Apache Software Foundation")]
-[assembly: AssemblyProduct("SpellChecker.Net")]
-[assembly: AssemblyCopyright("Copyright 2007 The Apache Software Foundation")]
-[assembly: AssemblyTrademark("Copyright 2007 The Apache Software Foundation")]
-[assembly: AssemblyDefaultAlias("Lucene.Net.SpellChecker")]
-[assembly: AssemblyCulture("")]
-
-[assembly: AssemblyInformationalVersionAttribute("3.0.3")]
-
-// 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("3.0.3")]
-
-//
-// 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("")]
-
-[assembly: AllowPartiallyTrustedCallers]
-
-
-//[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("SpellcheckTests")]
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02362804/src/contrib/SpellChecker/Contrib.SpellChecker.csproj
----------------------------------------------------------------------
diff --git a/src/contrib/SpellChecker/Contrib.SpellChecker.csproj b/src/contrib/SpellChecker/Contrib.SpellChecker.csproj
deleted file mode 100644
index 309b180..0000000
--- a/src/contrib/SpellChecker/Contrib.SpellChecker.csproj
+++ /dev/null
@@ -1,209 +0,0 @@
-\ufeff<?xml version="1.0" encoding="utf-8"?>
-<!--
-
- 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.
-
--->
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <ProjectType>Local</ProjectType>
- <ProductVersion>9.0.21022</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{FF45EE91-9CA3-443D-8231-75E9FA1AF40E}</ProjectGuid>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ApplicationIcon>
- </ApplicationIcon>
- <AssemblyKeyContainerName>
- </AssemblyKeyContainerName>
- <AssemblyName>Lucene.Net.Contrib.SpellChecker</AssemblyName>
- <AssemblyOriginatorKeyFile>Lucene.Net.snk</AssemblyOriginatorKeyFile>
- <DefaultClientScript>JScript</DefaultClientScript>
- <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
- <DefaultTargetSchema>IE50</DefaultTargetSchema>
- <DelaySign>false</DelaySign>
- <RootNamespace>Lucene.Net.Search.Spell</RootNamespace>
- <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
- <StartupObject>
- </StartupObject>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <UpgradeBackupLocation>
- </UpgradeBackupLocation>
- <OldToolsVersion>3.5</OldToolsVersion>
- <TargetFrameworkProfile />
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <Framework>$(TargetFrameworkVersion.Replace("v", "NET").Replace(".", ""))</Framework>
- <OutputPath>..\..\..\build\bin\contrib\SpellChecker\$(Configuration.Replace("35", ""))\$(Framework)\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>DEBUG;TRACE;$(Framework)</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>true</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <NoWarn>618</NoWarn>
- <Optimize>false</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>full</DebugType>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- <OutputType>Library</OutputType>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug35|AnyCPU' ">
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- <Framework>$(TargetFrameworkVersion.Replace("v", "NET").Replace(".", ""))</Framework>
- <OutputPath>..\..\..\build\bin\contrib\SpellChecker\$(Configuration.Replace("35", ""))\$(Framework)\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>DEBUG;TRACE;$(Framework)</DefineConstants>
- <DocumentationFile>
- </DocumentationFile>
- <DebugSymbols>true</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <NoWarn>618</NoWarn>
- <Optimize>false</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>full</DebugType>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- <OutputType>Library</OutputType>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <Framework>$(TargetFrameworkVersion.Replace("v", "NET").Replace(".", ""))</Framework>
- <OutputPath>..\..\..\build\bin\contrib\SpellChecker\$(Configuration.Replace("35", ""))\$(Framework)\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>TRACE;$(Framework)</DefineConstants>
- <DocumentationFile>..\..\..\build\bin\contrib\SpellChecker\$(Configuration.Replace("35", ""))\$(Framework)\Lucene.Net.Contrib.SpellChecker.XML</DocumentationFile>
- <DebugSymbols>true</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <NoWarn>618</NoWarn>
- <Optimize>true</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>pdbonly</DebugType>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- <OutputType>Library</OutputType>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release35|AnyCPU' ">
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- <Framework>$(TargetFrameworkVersion.Replace("v", "NET").Replace(".", ""))</Framework>
- <OutputPath>..\..\..\build\bin\contrib\SpellChecker\$(Configuration.Replace("35", ""))\$(Framework)\</OutputPath>
- <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
- <BaseAddress>285212672</BaseAddress>
- <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
- <ConfigurationOverrideFile>
- </ConfigurationOverrideFile>
- <DefineConstants>TRACE;$(Framework)</DefineConstants>
- <DocumentationFile>..\..\..\build\bin\contrib\SpellChecker\$(Configuration.Replace("35", ""))\$(Framework)\Lucene.Net.Contrib.SpellChecker.XML</DocumentationFile>
- <DebugSymbols>true</DebugSymbols>
- <FileAlignment>4096</FileAlignment>
- <NoStdLib>false</NoStdLib>
- <NoWarn>618</NoWarn>
- <Optimize>true</Optimize>
- <RegisterForComInterop>false</RegisterForComInterop>
- <RemoveIntegerChecks>false</RemoveIntegerChecks>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningLevel>4</WarningLevel>
- <DebugType>pdbonly</DebugType>
- <ErrorReport>prompt</ErrorReport>
- <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
- <OutputType>Library</OutputType>
- </PropertyGroup>
- <PropertyGroup>
- <SignAssembly>true</SignAssembly>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System">
- <Name>System</Name>
- </Reference>
- <Reference Condition="'$(Framework)' == 'NET35'" Include="System.Core" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AssemblyInfo.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Spell\IDictionary.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Spell\JaroWinklerDistance.cs" />
- <Compile Include="Spell\LevenshteinDistance.cs" />
- <Compile Include="Spell\LuceneDictionary.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Spell\NGramDistance.cs" />
- <Compile Include="Spell\PlainTextDictionary.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Spell\SpellChecker.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Spell\StringDistance.cs" />
- <Compile Include="Spell\SuggestWord.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Spell\SuggestWordQueue.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Spell\TRStringDistance.cs">
- <SubType>Code</SubType>
- </Compile>
- <Content Include="Spell\Package.html" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\core\Lucene.Net.csproj">
- <Project>{5D4AD9BE-1FFB-41AB-9943-25737971BF57}</Project>
- <Name>Lucene.Net</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="Lucene.Net.snk" />
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <PropertyGroup>
- <PreBuildEvent>
- </PreBuildEvent>
- <PostBuildEvent>
- </PostBuildEvent>
- </PropertyGroup>
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02362804/src/contrib/SpellChecker/HISTORY.txt
----------------------------------------------------------------------
diff --git a/src/contrib/SpellChecker/HISTORY.txt b/src/contrib/SpellChecker/HISTORY.txt
deleted file mode 100644
index a33f707..0000000
--- a/src/contrib/SpellChecker/HISTORY.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-SpellChecker.Net History
-------------------------
-
-
-29Jan07:
- - Release: SpellChecker.Net.2.0.0 build 001
-30May10:
- - Release: SpellChecker.Net.2.9.2 build 001
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02362804/src/contrib/SpellChecker/Spell/IDictionary.cs
----------------------------------------------------------------------
diff --git a/src/contrib/SpellChecker/Spell/IDictionary.cs b/src/contrib/SpellChecker/Spell/IDictionary.cs
deleted file mode 100644
index 53b916f..0000000
--- a/src/contrib/SpellChecker/Spell/IDictionary.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.
- */
-
-
-namespace SpellChecker.Net.Search.Spell
-{
-
- /// <summary> A simple interface representing a Dictionary</summary>
- public interface IDictionary
- {
- /// <summary> return all the words present in the dictionary</summary>
- /// <returns> Iterator
- /// </returns>
- System.Collections.Generic.IEnumerator<string> GetWordsIterator();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02362804/src/contrib/SpellChecker/Spell/JaroWinklerDistance.cs
----------------------------------------------------------------------
diff --git a/src/contrib/SpellChecker/Spell/JaroWinklerDistance.cs b/src/contrib/SpellChecker/Spell/JaroWinklerDistance.cs
deleted file mode 100644
index 5879683..0000000
--- a/src/contrib/SpellChecker/Spell/JaroWinklerDistance.cs
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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.Linq;
-
-namespace SpellChecker.Net.Search.Spell
-{
-
- using System;
-
- public class JaroWinklerDistance : StringDistance
- {
- private float threshold = 0.7f;
-
- private static int[] Matches(String s1, String s2)
- {
- String Max, Min;
-
- if (s1.Length > s2.Length)
- {
- Max = s1;
- Min = s2;
- }
- else
- {
- Max = s2;
- Min = s1;
- }
-
- var range = Math.Max(Max.Length / 2 - 1, 0);
- var matchIndexes = new int[Min.Length];
-
- for (var i = 0; i < matchIndexes.Length; i++)
- matchIndexes[i] = -1;
-
- var matchFlags = new bool[Max.Length];
- var matches = 0;
-
- for (var mi = 0; mi < Min.Length; mi++)
- {
- var c1 = Min[mi];
- for (int xi = Math.Max(mi - range, 0),
- xn = Math.Min(mi + range + 1, Max.Length); xi < xn; xi++)
- {
- if (matchFlags[xi] || c1 != Max[xi]) continue;
-
- matchIndexes[mi] = xi;
- matchFlags[xi] = true;
- matches++;
- break;
- }
- }
-
- var ms1 = new char[matches];
- var ms2 = new char[matches];
-
- for (int i = 0, si = 0; i < Min.Length; i++)
- {
- if (matchIndexes[i] != -1)
- {
- ms1[si] = Min[i];
- si++;
- }
- }
-
- for (int i = 0, si = 0; i < Max.Length; i++)
- {
- if (matchFlags[i])
- {
- ms2[si] = Max[i];
- si++;
- }
- }
-
- var transpositions = ms1.Where((t, mi) => t != ms2[mi]).Count();
-
- var prefix = 0;
- for (var mi = 0; mi < Min.Length; mi++)
- {
- if (s1[mi] == s2[mi])
- {
- prefix++;
- }
- else
- {
- break;
- }
- }
-
- return new int[] { matches, transpositions / 2, prefix, Max.Length };
- }
-
- public float GetDistance(String s1, String s2)
- {
- var mtp = Matches(s1, s2);
- var m = (float)mtp[0];
-
- if (m == 0)
- return 0f;
-
- float j = ((m / s1.Length + m / s2.Length + (m - mtp[1]) / m)) / 3;
- float jw = j < Threshold ? j : j + Math.Min(0.1f, 1f / mtp[3]) * mtp[2] * (1 - j);
- return jw;
- }
-
- /// <summary>
- /// Gets or sets the current value of the threshold used for adding the Winkler bonus.
- /// Set to a negative value to get the Jaro distance. The default value is 0.7.
- /// </summary>
- public float Threshold
- {
- get { return threshold; }
- set { this.threshold = value; }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02362804/src/contrib/SpellChecker/Spell/LevenshteinDistance.cs
----------------------------------------------------------------------
diff --git a/src/contrib/SpellChecker/Spell/LevenshteinDistance.cs b/src/contrib/SpellChecker/Spell/LevenshteinDistance.cs
deleted file mode 100644
index b940ef8..0000000
--- a/src/contrib/SpellChecker/Spell/LevenshteinDistance.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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 System.Collections.Generic;
-using System.Text;
-using SpellChecker.Net.Search.Spell;
-
-namespace SpellChecker.Net.Search.Spell
-{
- /// <summary>
- /// Levenshtein edit distance
- /// </summary>
- public class LevenshteinDistance : StringDistance
- {
- /// <summary>
- /// Returns a float between 0 and 1 based on how similar the specified strings are to one another.
- /// Returning a value of 1 means the specified strings are identical and 0 means the
- /// string are maximally different.
- /// </summary>
- /// <param name="target">The first string.</param>
- /// <param name="other">The second string.</param>
- /// <returns>a float between 0 and 1 based on how similar the specified strings are to one another.</returns>
- public float GetDistance(String target, String other)
- {
- char[] sa;
- int n;
- int[] p; //'previous' cost array, horizontally
- int[] d; // cost array, horizontally
- int[] _d; //placeholder to assist in swapping p and d
-
- /*
- The difference between this impl. and the previous is that, rather
- than creating and retaining a matrix of size s.length()+1 by t.length()+1,
- we maintain two single-dimensional arrays of length s.length()+1. The first, d,
- is the 'current working' distance array that maintains the newest distance cost
- counts as we iterate through the characters of String s. Each time we increment
- the index of String t we are comparing, d is copied to p, the second int[]. Doing so
- allows us to retain the previous cost counts as required by the algorithm (taking
- the minimum of the cost count to the left, up one, and diagonally up and to the left
- of the current cost count being calculated). (Note that the arrays aren't really
- copied anymore, just switched...this is clearly much better than cloning an array
- or doing a System.arraycopy() each time through the outer loop.)
-
- Effectively, the difference between the two implementations is this one does not
- cause an out of memory condition when calculating the LD over two very large strings.
- */
-
- sa = target.ToCharArray();
- n = sa.Length;
- p = new int[n + 1];
- d = new int[n + 1];
- int m = other.Length;
-
- if (n == 0 || m == 0)
- {
- if (n == m)
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
-
-
- // indexes into strings s and t
- int i; // iterates through s
- int j; // iterates through t
-
- char t_j; // jth character of t
-
- int cost; // cost
-
- for (i = 0; i <= n; i++)
- {
- p[i] = i;
- }
-
- for (j = 1; j <= m; j++)
- {
- t_j = other[j - 1];
- d[0] = j;
-
- for (i = 1; i <= n; i++)
- {
- cost = sa[i - 1] == t_j ? 0 : 1;
- // minimum of cell to the left+1, to the top+1, diagonally left and up +cost
- d[i] = Math.Min(Math.Min(d[i - 1] + 1, p[i] + 1), p[i - 1] + cost);
- }
-
- // copy current distance counts to 'previous row' distance counts
- _d = p;
- p = d;
- d = _d;
- }
-
- // our last action in the above loop was to switch d and p, so p now
- // actually has the most recent cost counts
- return 1.0f - ((float)p[n] / Math.Max(other.Length, sa.Length));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02362804/src/contrib/SpellChecker/Spell/LuceneDictionary.cs
----------------------------------------------------------------------
diff --git a/src/contrib/SpellChecker/Spell/LuceneDictionary.cs b/src/contrib/SpellChecker/Spell/LuceneDictionary.cs
deleted file mode 100644
index 3771f24..0000000
--- a/src/contrib/SpellChecker/Spell/LuceneDictionary.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * 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.Collections;
-using Lucene.Net.Documents;
-
-namespace SpellChecker.Net.Search.Spell
-{
- using System;
- using IndexReader = Lucene.Net.Index.IndexReader;
- using TermEnum = Lucene.Net.Index.TermEnum;
- using Term = Lucene.Net.Index.Term;
-
- /// <summary>
- /// Lucene Dictionary
- /// </summary>
- public class LuceneDictionary : IDictionary, System.Collections.Generic.IEnumerable<string>
- {
- internal IndexReader reader;
- internal System.String field;
-
- public LuceneDictionary(IndexReader reader, System.String field)
- {
- this.reader = reader;
- this.field = field;
- }
-
- virtual public System.Collections.Generic.IEnumerator<string> GetWordsIterator()
- {
- return new LuceneIterator(this);
- }
-
- public System.Collections.Generic.IEnumerator<string> GetEnumerator()
- {
- return GetWordsIterator();
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- internal sealed class LuceneIterator : System.Collections.Generic.IEnumerator<string>
- {
- private readonly TermEnum termEnum;
- private Term actualTerm;
- private bool hasNextCalled;
-
- private readonly LuceneDictionary enclosingInstance;
-
- public LuceneIterator(LuceneDictionary enclosingInstance)
- {
- this.enclosingInstance = enclosingInstance;
- try
- {
- termEnum = enclosingInstance.reader.Terms(new Term(enclosingInstance.field, ""));
- }
- catch (System.IO.IOException ex)
- {
- System.Console.Error.WriteLine(ex.StackTrace);
- }
- }
-
- public string Current
- {
- get
- {
- if (!hasNextCalled)
- {
- MoveNext();
- }
- hasNextCalled = false;
- return (actualTerm != null) ? actualTerm.Text : null;
- }
-
- }
-
- object IEnumerator.Current
- {
- get { return Current; }
- }
-
- public bool MoveNext()
- {
- hasNextCalled = true;
-
- actualTerm = termEnum.Term;
-
- // if there are no words return false
- if (actualTerm == null) return false;
-
- System.String fieldt = actualTerm.Field;
- termEnum.Next();
-
- // if the next word doesn't have the same field return false
- if (fieldt != enclosingInstance.field)
- {
- actualTerm = null;
- return false;
- }
- return true;
- }
-
- public void Remove()
- {
-
- }
-
- public void Reset()
- {
-
- }
-
- public void Dispose()
- {
- // Nothing
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02362804/src/contrib/SpellChecker/Spell/NGramDistance.cs
----------------------------------------------------------------------
diff --git a/src/contrib/SpellChecker/Spell/NGramDistance.cs b/src/contrib/SpellChecker/Spell/NGramDistance.cs
deleted file mode 100644
index 14c3c9e..0000000
--- a/src/contrib/SpellChecker/Spell/NGramDistance.cs
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * 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 System.Collections.Generic;
-using System.Text;
-
-namespace SpellChecker.Net.Search.Spell
-{
- public class NGramDistance : StringDistance
- {
- private int n;
-
- /// <summary>
- /// Creates an N-Gram distance measure using n-grams of the specified size.
- /// </summary>
- /// <param name="size">The size of the n-gram to be used to compute the string distance.</param>
- public NGramDistance(int size)
- {
- this.n = size;
- }
-
- /// <summary>
- /// Creates an N-Gram distance measure using n-grams of size 2.
- /// </summary>
- public NGramDistance()
- : this(2)
- {
- }
-
- public float GetDistance(String source, String target)
- {
- int sl = source.Length;
- int tl = target.Length;
-
- if (sl == 0 || tl == 0)
- {
- if (sl == tl)
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
-
- int cost = 0;
- if (sl < n || tl < n)
- {
- for (int ii = 0, ni = Math.Min(sl, tl); ii < ni; ii++)
- {
- if (source[ii] == target[ii])
- {
- cost++;
- }
- }
- return (float)cost / Math.Max(sl, tl);
- }
-
- char[] sa = new char[sl + n - 1];
- float[] p; //'previous' cost array, horizontally
- float[] d; // cost array, horizontally
- float[] _d; //placeholder to assist in swapping p and d
-
- //construct sa with prefix
- for (int ii = 0; ii < sa.Length; ii++)
- {
- if (ii < n - 1)
- {
- sa[ii] = (char)0; //add prefix
- }
- else
- {
- sa[ii] = source[ii - n + 1];
- }
- }
- p = new float[sl + 1];
- d = new float[sl + 1];
-
- // indexes into strings s and t
- int i; // iterates through source
- int j; // iterates through target
-
- char[] t_j = new char[n]; // jth n-gram of t
-
- for (i = 0; i <= sl; i++)
- {
- p[i] = i;
- }
-
- for (j = 1; j <= tl; j++)
- {
- //construct t_j n-gram
- if (j < n)
- {
- for (int ti = 0; ti < n - j; ti++)
- {
- t_j[ti] = (char)0; //add prefix
- }
- for (int ti = n - j; ti < n; ti++)
- {
- t_j[ti] = target[ti - (n - j)];
- }
- }
- else
- {
- t_j = target.Substring(j - n, n).ToCharArray();
- }
- d[0] = j;
- for (i = 1; i <= sl; i++)
- {
- cost = 0;
- int tn = n;
- //compare sa to t_j
- for (int ni = 0; ni < n; ni++)
- {
- if (sa[i - 1 + ni] != t_j[ni])
- {
- cost++;
- }
- else if (sa[i - 1 + ni] == 0)
- { //discount matches on prefix
- tn--;
- }
- }
- float ec = (float)cost / tn;
- // minimum of cell to the left+1, to the top+1, diagonally left and up +cost
- d[i] = Math.Min(Math.Min(d[i - 1] + 1, p[i] + 1), p[i - 1] + ec);
- }
- // copy current distance counts to 'previous row' distance counts
- _d = p;
- p = d;
- d = _d;
- }
-
- // our last action in the above loop was to switch d and p, so p now
- // actually has the most recent cost counts
- return 1.0f - ((float)p[sl] / Math.Max(tl, sl));
- }
-
-
- }
-}
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02362804/src/contrib/SpellChecker/Spell/Package.html
----------------------------------------------------------------------
diff --git a/src/contrib/SpellChecker/Spell/Package.html b/src/contrib/SpellChecker/Spell/Package.html
deleted file mode 100644
index 8585307..0000000
--- a/src/contrib/SpellChecker/Spell/Package.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!--
-
- 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.
-
--->
-
-<html><head></head>
-<body>
-Suggest alternate spellings for words.
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/02362804/src/contrib/SpellChecker/Spell/PlainTextDictionary.cs
----------------------------------------------------------------------
diff --git a/src/contrib/SpellChecker/Spell/PlainTextDictionary.cs b/src/contrib/SpellChecker/Spell/PlainTextDictionary.cs
deleted file mode 100644
index 586450a..0000000
--- a/src/contrib/SpellChecker/Spell/PlainTextDictionary.cs
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * 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 : IDictionary, System.Collections.Generic.IEnumerable<string>
- {
- virtual public System.Collections.Generic.IEnumerator<string> GetWordsIterator()
- {
- return new FileIterator(this);
- }
-
- public System.Collections.Generic.IEnumerator<string> GetEnumerator()
- {
- return GetWordsIterator();
- }
-
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- 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.Generic.IEnumerator<string>
- {
- public FileIterator(PlainTextDictionary enclosingInstance)
- {
- InitBlock(enclosingInstance);
- }
-
- private void InitBlock(PlainTextDictionary enclosingInstance)
- {
- this.enclosingInstance = enclosingInstance;
- }
-
- private PlainTextDictionary enclosingInstance;
-
- public string Current
- {
- get
- {
- if (!Enclosing_Instance.has_next_called)
- {
- MoveNext();
- }
- Enclosing_Instance.has_next_called = false;
- return Enclosing_Instance.line;
- }
- }
-
- object System.Collections.IEnumerator.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()
- {
- }
-
- public void Dispose()
- {
-
- }
- }
- }
-}
\ No newline at end of file