Exemplo n.º 1
0
        private string MyCorefferencer(string str)
        {
            var modelPath         = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + @"\Models\Coref";
            var coreferenceFinder = new TreebankLinker(modelPath);
            var sentences         = MySentenceDetector(str); //["Mr. & Mrs. Smith is a 2005 American romantic comedy action film.",
                                                             //"The film stars Brad Pitt and Angelina Jolie as a bored upper-middle class married couple.",
                                                             //"They are surprised to learn that they are both assassins hired by competing agencies to kill each other."];
            var coref = coreferenceFinder.GetCoreferenceParse(sentences);

            return(coref);
        }
Exemplo n.º 2
0
        private string IdentifyCoreferents(IEnumerable <string> sentences)
        {
            if (_coreferenceFinder == null)
            {
                _coreferenceFinder = new TreebankLinker(_modelPath + "coref");
            }

            var parsedSentences = new List <Parse>();

            foreach (string sentence in sentences)
            {
                Parse sentenceParse = ParseSentence(sentence);
                parsedSentences.Add(sentenceParse);
            }
            return(_coreferenceFinder.GetCoreferenceParse(parsedSentences.ToArray()));
        }
Exemplo n.º 3
0
        internal string IdentifyCoreferents(string[] sentences)
        {
            if (_mCoreferenceFinder == null)
            {
                _mCoreferenceFinder = new TreebankLinker(_modelPath + "coref");
            }

            var parsedSentences = new List <Parse>();

            foreach (string sentence in sentences)
            {
                Parse  sentenceParse = ParseSentence(sentence);
                string findNames     = FindNames(sentenceParse);
                parsedSentences.Add(sentenceParse);
            }
            return(_mCoreferenceFinder.GetCoreferenceParse(parsedSentences.ToArray()));
        }