예제 #1
0
    public string buildTrie()
    {
        JTrie        dict         = new JTrie();
        var          filePath     = System.IO.Path.GetTempPath() + "\\wiki.txt";
        StreamReader streamReader = new StreamReader(filePath);
        float        mem          = theMemCounter.NextValue();
        int          counter      = 0;

        while (mem > 50 && streamReader.EndOfStream == false)
        {
            try
            {
                string text = streamReader.ReadLine();
                dict.Add(text);
                counter++;
                if (counter % 1000 == 0)
                {
                    mem = theMemCounter.NextValue();
                }
            }
            catch
            {
            }
        }
        streamReader.Close();
        gen = dict;
        return("Success");
    }