Example #1
0
        /// <summary>
        /// Initializes a new instance of the SharpNLPTagger class its analysis behavior specified by the provied TaggerMode value.
        /// </summary>
        /// <param name="taggingMode">Specifies the mode under which the tagger will operate.</param>
        /// <param name="sourcePath">The path to a text file whose contents will be read and tagged.</param>
        /// <param name="destinationPath">The optional path specifying the location where the tagged file should be created. If not provided, the tagged file will be placed in the same directory as the source.</param>
        public SharpNLPTagger(TaggerMode taggingMode, string sourcePath, string destinationPath = null)
            : this(taggingMode)
        {
            inputFilePath  = sourcePath;
            outputFilePath = destinationPath != null ? destinationPath :
                             new FileInfo(sourcePath).DirectoryName + @"\" + new FileInfo(sourcePath.Substring(0, sourcePath.LastIndexOf('.'))).Name + @".tagged";

            SourceText = LoadSourceText();
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the SharpNLPTagger class with its behavior specified by the provided TaggerMode value.
        /// </summary>
        /// <param name="taggingMode">Specifies the mode under which the tagger will operate.</param>
        public SharpNLPTagger(TaggerMode taggingMode)
        {
            string resourcesDirectory;

            TaggingMode = taggingMode;
            if (Settings != null)
            {
                resourcesDirectory = Settings["ResourcesDirectory"];
                mModelPath         = resourcesDirectory + Settings["MaximumEntropyModelDirectory"];
                mNameFinderPath    = resourcesDirectory + Settings["WordnetSearchDirectory"];
            }
            else
            {
                resourcesDirectory = ConfigurationManager.AppSettings["ResourcesDirectory"];
                mModelPath         = resourcesDirectory + ConfigurationManager.AppSettings["MaximumEntropyModelDirectory"];
                mNameFinderPath    = resourcesDirectory + ConfigurationManager.AppSettings["WordnetSearchDirectory"];
            }

            mNameFinder = new OpenNLP.Tools.NameFind.EnglishNameFinder(mNameFinderPath);
        }
Example #3
0
        protected string ParseViaTaggingMode(TaggerMode taggingMode)
        {
            switch (taggingMode)
            {
            case TaggerMode.TagIndividual:
                return(POSTag());

            case TaggerMode.TagAndAggregate:
                return(Chunk());

            case TaggerMode.FullyNestingParse:
                return(Parse());

            case TaggerMode.GenderFind:

                return(Gender());

            case TaggerMode.NameFind:
                return(NameFind());

            default:
                return(POSTag());
            }
        }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the Tagger Class which will use the specified <see cref="TaggerInterop.TaggerMode"/>.
 /// </summary>
 public Tagger(TaggerMode taggerMode)
 {
     TaggerMode = taggerMode;
 }
Example #5
0
 public QuickTagger(TaggerMode option)
     : base(option)
 {
 }
Example #6
0
 protected async System.Threading.Tasks.Task <string> ParseViaTaggingModeAsync(TaggerMode taggingMode)
 {
     return(await ParseViaTaggingModeAsync(taggingMode));
 }