Ejemplo n.º 1
0
        public static void TestPurePython()
        {
            // Initialization required
            Nltk.Init(new List <string>
            {
                @"C:\IronPython27\Lib",
                @"C:\IronPython27\Lib\site-packages",
            });


            // Imports NLTK corpus module
            Nltk.Py.ImportModule("nltk.corpus");

            // Import 'names' object to access corpus content
            Nltk.Py.ExecuteScript("from nltk.corpus import names");

            // Get object by name
            dynamic namesObj = Nltk.Py.GetObject("names");

            // Call object's method 'names.words()'
            dynamic namesList = Nltk.Py.CallMethod(namesObj, "words");

            foreach (var name in namesList)
            {
                Console.Write(name + ", ");
            }
        }
Ejemplo n.º 2
0
        public static void OverallTest()
        {
            Nltk.Init(new List <string>()
            {
                @"C:\IronPython27\Lib",
                @"C:\IronPython27\Lib\site-packages",
            });

            TestImport();
            TestStandard();
        }
Ejemplo n.º 3
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            Task.Run(() =>
            {
                Log("Nltk.Init() Begin");

                Nltk.Init(new List <string>
                {
                    @"C:\IronPython27\Lib",
                    @"C:\IronPython27\Lib\site-packages",
                });

                Log("Nltk.Init() Done");
            });
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            Nltk.Init(new List <string>
            {
                @"C:\IronPython27\Lib",
                @"C:\IronPython27\Lib\site-packages",
            });


            //TestCorpus.TestBrown();

            TestPosTagger();

            //TestNltkResultClass();
            //TestTokenize();
            //TestProbability();
            //TestStem();

            //Workarounds.TestPurePython();
        }