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 + ", "); } }
public static void OverallTest() { Nltk.Init(new List <string>() { @"C:\IronPython27\Lib", @"C:\IronPython27\Lib\site-packages", }); TestImport(); TestStandard(); }
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"); }); }
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(); }