示例#1
0
        public static string MakeLex(string lexfileStem)
        {
            string infile  = lexfileStem + ".brill";
            string outfile = lexfileStem + ".dat";

            if (!HostSystem.FileExists(outfile))
            {
                MakeLex(infile, outfile);
            }
            return(outfile);
        }
 internal static void InitTagHandlers()
 {
     CustomTags = new Dictionary <string, TagHandler>();
     //this.GraphMaster = new GraphMaster();
     //this.HeardSelfSayGraph = new GraphMaster();
     if (HostSystem.FileExists("AIMLbot.dll"))
     {
         loadCustomTagHandlers("AIMLbot.dll");
     }
     if (HostSystem.FileExists("AIMLbot.exe"))
     {
         loadCustomTagHandlers("AIMLbot.exe");
     }
 }
示例#3
0
        internal long LoadFileByLines0(string filename, WordExpander expandWithWordNet)
        {
            checkDbLock();
            long   totals = 0;
            string line;
            long   linecount = 0;

            if (HostSystem.FileExists(filename))
            {
                string absoluteFileName                   = HostSystem.GetAbsolutePath(filename);
                System.IO.TextReader       tr             = new StreamReader(absoluteFileName);
                Dictionary <ulong, string> contentIdPairs = new Dictionary <ulong, string>();

                while ((linecount < 80000) && ((line = tr.ReadLine()) != null))
                {
                    linecount++;
                    if (linecount % 1000 == 0)
                    {
                        // batch a 1000
                        writeToLog("Lucene learn {0}", linecount);
                        int numIndexedb = Index(contentIdPairs, expandWithWordNet);
                        writeToLog("Indexed {0} lines.", numIndexedb);
                        totals += linecount;

                        contentIdPairs = new Dictionary <ulong, string>();
                    }
                    line = line.Trim();
                    if (line.Length != 0 && line[0] != '#')
                    {
                        contentIdPairs.Add(IncDocId(), line);
                    }
                }
                tr.Close();
                // Indexing:
                int numIndexed = Index(contentIdPairs, expandWithWordNet);
                writeToLog("Indexed {0} lines.", numIndexed);


                writeToLog("Last Line Mlearn {0}", linecount);
            }
            else
            {
                writeToLog(" LoadFileByLines cannot find file '{0}'", filename);
            }
            return(totals);
        }
示例#4
0
 public void SuggestPath(string path)
 {
     if (NullOrStar(path))
     {
         return;
     }
     if (NullOrStar(CurrentlyLoadingFrom))
     {
         CurrentlyLoadingFrom = path;
     }
     if (NullOrStar(CurrentFilename))
     {
         CurrentFilename = path;
     }
     else
     {
         if (HostSystem.FileExists(path))
         {
             CurrentFilename = path;
         }
     }
 }