Lucene.Net
3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
Main Page
Packages
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Properties
contrib
Analyzers
WordlistLoader.cs
Go to the documentation of this file.
1
/*
2
*
3
* Licensed to the Apache Software Foundation (ASF) under one
4
* or more contributor license agreements. See the NOTICE file
5
* distributed with this work for additional information
6
* regarding copyright ownership. The ASF licenses this file
7
* to you under the Apache License, Version 2.0 (the
8
* "License"); you may not use this file except in compliance
9
* with the License. You may obtain a copy of the License at
10
*
11
* http://www.apache.org/licenses/LICENSE-2.0
12
*
13
* Unless required by applicable law or agreed to in writing,
14
* software distributed under the License is distributed on an
15
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
* KIND, either express or implied. See the License for the
17
* specific language governing permissions and limitations
18
* under the License.
19
*
20
*/
21
22
//using System;
23
//using System.IO;
24
//using System.Collections;
25
26
//namespace Lucene.Net.Analysis
27
//{
28
// /// <summary>
29
// /// Loads a text file and adds every line as an entry to a Hashtable. Every line
30
// /// should contain only one word. If the file is not found or on any error, an
31
// /// empty table is returned.
32
// /// </summary>
33
// public class WordlistLoader
34
// {
35
// /// <summary>
36
// /// Load words table from the file
37
// /// </summary>
38
// /// <param name="path">Path to the wordlist</param>
39
// /// <param name="wordfile">Name of the wordlist</param>
40
// /// <returns></returns>
41
// public static Hashtable GetWordSet( String path, String wordfile )
42
// {
43
// if ( path == null || wordfile == null )
44
// {
45
// return new Hashtable();
46
// }
47
// return GetWordSet(new FileInfo(path + "\\" + wordfile));
48
// }
49
50
// /// <summary>
51
// /// Load words table from the file
52
// /// </summary>
53
// /// <param name="wordfile">Complete path to the wordlist</param>
54
// /// <returns></returns>
55
// public static Hashtable GetWordSet( String wordfile )
56
// {
57
// if ( wordfile == null )
58
// {
59
// return new Hashtable();
60
// }
61
// return GetWordSet( new FileInfo( wordfile ) );
62
// }
63
64
// /// <summary>
65
// /// Load words table from the file
66
// /// </summary>
67
// /// <param name="wordfile">File containing the wordlist</param>
68
// /// <returns></returns>
69
// public static Hashtable GetWordSet( FileInfo wordfile )
70
// {
71
// if ( wordfile == null )
72
// {
73
// return new Hashtable();
74
// }
75
// StreamReader lnr = new StreamReader(wordfile.FullName);
76
// return GetWordSet(lnr);
77
// }
78
79
// /// <summary>
80
// /// Reads lines from a Reader and adds every line as an entry to a HashSet (omitting
81
// /// leading and trailing whitespace). Every line of the Reader should contain only
82
// /// one word. The words need to be in lowercase if you make use of an
83
// /// Analyzer which uses LowerCaseFilter (like StandardAnalyzer).
84
// /// </summary>
85
// /// <param name="reader">Reader containing the wordlist</param>
86
// /// <returns>A Hashtable with the reader's words</returns>
87
// public static Hashtable GetWordSet(TextReader reader)
88
// {
89
// Hashtable result = new Hashtable();
90
// try
91
// {
92
// ArrayList stopWords = new ArrayList();
93
// String word = null;
94
// while ( ( word = reader.ReadLine() ) != null )
95
// {
96
// stopWords.Add(word.Trim());
97
// }
98
// result = MakeWordTable( (String[])stopWords.ToArray(typeof(string)), stopWords.Count);
99
// }
100
// // On error, use an empty table
101
// catch (IOException)
102
// {
103
// result = new Hashtable();
104
// }
105
// return result;
106
// }
107
108
109
// /// <summary>
110
// /// Builds the wordlist table.
111
// /// </summary>
112
// /// <param name="words">Word that where read</param>
113
// /// <param name="length">Amount of words that where read into <tt>words</tt></param>
114
// /// <returns></returns>
115
// private static Hashtable MakeWordTable( String[] words, int length )
116
// {
117
// Hashtable table = new Hashtable( length );
118
// for ( int i = 0; i < length; i++ )
119
// {
120
// table.Add(words[i], words[i]);
121
// }
122
// return table;
123
// }
124
// }
125
//}
Generated on Thu Jan 3 2013 02:12:43 for Lucene.Net by
1.8.3