Lucene.Net.Analysis.WordlistLoader.GetStemDict C# (CSharp) Method

GetStemDict() public static method

Reads a stem dictionary. Each line contains: word\tstem (i.e. two tab seperated words)
public static GetStemDict ( System wordstemfile ) : string>.Dictionary
wordstemfile System
return string>.Dictionary
		public static Dictionary<string, string> GetStemDict(System.IO.FileInfo wordstemfile)
		{
			if (wordstemfile == null)
				throw new System.NullReferenceException("wordstemfile may not be null");
            var result = new Dictionary<string, string>();
			System.IO.StreamReader br = null;
			System.IO.StreamReader fr = null;
			try
			{
				fr = new System.IO.StreamReader(wordstemfile.FullName, System.Text.Encoding.Default);
				br = new System.IO.StreamReader(fr.BaseStream, fr.CurrentEncoding);
				System.String line;
                char[] tab = {'\t'};
				while ((line = br.ReadLine()) != null)
				{
					System.String[] wordstem = line.Split(tab, 2);
					result[wordstem[0]] = wordstem[1];
				}
			}
			finally
			{
				if (fr != null)
					fr.Close();
				if (br != null)
					br.Close();
			}
			return result;
		}
	}