예제 #1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public static void InsertAllFactors()
        {
            var sessProv = new SessionProvider();

            var descMap = new Dictionary <WordNetEngine.SynSetRelation, DescriptorTypeId>();

            descMap.Add(WordNetEngine.SynSetRelation.Hypernym, DescriptorTypeId.IsA);

            using (ISession sess = sessProv.OpenSession()) {
                sess.CreateSQLQuery("DELETE FROM " + typeof(Factor).Name).UniqueResult();
                BuildWordNet.SetDbStateBeforeBatchInsert(sess);
            }

            ArtifactSet artSet;

            using (ISession sess = sessProv.OpenSession()) {
                artSet = new ArtifactSet(sess);
            }

            var sf = new SemanticFactors(artSet);

            sf.Start();

            var lf = new LexicalFactors(artSet);

            lf.Start();

            var cf = new CustomFactors(artSet);

            cf.Start();

            using (ISession sess = sessProv.OpenSession()) {
                BuildWordNet.SetDbStateAfterBatchInsert(sess);
            }
        }
예제 #2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public static void Main(string[] pArgs)
        {
            DbBuilder.InitOnce();
            //DbBuilder.UpdateSchema();
            const int step = 2;

            switch (step)
            {
            case 0:
                using (ISession sess = new SessionProvider().OpenSession()) {
                    BuildWordNet.BuildBaseDb(sess);
                    //Stats.PrintAll(sess);
                }
                break;

            case 1:
                using (ISession sess = new SessionProvider().OpenSession()) {
                    BuildArtifacts.InsertWordAndSynsetArtifacts(sess);
                }
                break;

            case 2:
                BuildFactors.InsertAllFactors();
                break;
            }
        }
예제 #3
0
        //SELECT Name, Disamb, COUNT(Name) FROM Artifact GROUP BY Name, Disamb HAVING COUNT(Name) > 1 ORDER BY COUNT(Name) DESC


        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public static void InsertWordAndSynsetArtifacts(ISession pSess)
        {
            pSess.CreateSQLQuery("DELETE FROM " + typeof(Artifact).Name + " WHERE 1=1").UniqueResult();
            BuildWordNet.SetDbStateBeforeBatchInsert(pSess);

            var nodes = new SemanticNodes(pSess);

            Console.WriteLine("Garbage collection...");
            GC.Collect();
            Console.WriteLine("Garbage collection complete");

            var iaa = new InsertAllArtifacts(nodes);

            Console.WriteLine("Garbage collection...");
            GC.Collect();
            Console.WriteLine("Garbage collection complete");

            iaa.Insert(pSess);

            BuildWordNet.SetDbStateAfterBatchInsert(pSess);
        }