public static void Demonstrate(string text, POSMode partOfSpeechMode, NERMode namedEntityRecognitionMode, bool disableLogging = true) { if (disableLogging) { RedwoodConfiguration.current().clear().apply(); } //Input //Console.WriteLine("Input: {0}\n\n\n", text); ////Tokenization //Console.WriteLine("Tokenization:"); //Tokenisation.TokenizeText(text); //Console.WriteLine("\n\n\n"); ////POS //Console.WriteLine("Part Of Speech:"); //PartOfSpeech.Tag(text, partOfSpeechMode); //Console.WriteLine("\n\n\n"); ////NER //Console.WriteLine("Named Entity Recognition:"); //var ner = new NER(namedEntityRecognitionMode); //Console.WriteLine(ner.classifyToString(text)); //Console.WriteLine("\n\n\n"); ////Parser //Console.WriteLine("Parsed Text:"); //Parser.ParseString(text); //Console.WriteLine("\n\n\n"); //Find co-reference CorefAnnotator.FindCoreferenceResolution(text); }
public static void Tag(string text, POSMode posMode = POSMode.Left3Words) { //Loading POS Tagger var tagger = new PartOfSpeech(posMode); var taggedResult = tagger.TagSentences(text); System.Console.WriteLine(taggedResult); }
public PartOfSpeech(POSMode posMode) { _modelPath = _modelPath + GetPOSModel(posMode); if (!System.IO.File.Exists(_modelPath)) { throw new Exception($"Check path to the model file '{_modelPath}'"); } _tagger = new MaxentTagger(_modelPath); }
private static string GetPOSModel(POSMode posMode) { switch (posMode) { case POSMode.Bidirectional: return(@"/english-bidirectional/english-bidirectional-distsim.tagger"); default: return(@"/english-left3words/english-left3words-distsim.tagger"); } }