/**
         * <summary> Creates a morphological disambiguation corpus from the corpus.</summary>
         *
         * <returns>Created disambiguation corpus.</returns>
         */
        public DisambiguationCorpus Generate()
        {
            var corpus = new DisambiguationCorpus();

            for (var i = 0; i < _annotatedCorpus.SentenceCount(); i++)
            {
                var sentence = _annotatedCorpus.GetSentence(i);
                var disambiguationSentence = new AnnotatedSentence.AnnotatedSentence("");
                for (var j = 0; j < sentence.WordCount(); j++)
                {
                    disambiguationSentence.AddWord(new DisambiguatedWord(sentence.GetWord(j).GetName(),
                                                                         ((AnnotatedWord)sentence.GetWord(j)).GetParse()));
                }

                corpus.AddSentence(disambiguationSentence);
            }

            return(corpus);
        }
示例#2
0
        /**
         * <summary> Creates a morphological disambiguation corpus from the treeBank. Calls generateAnnotatedSentence for each parse
         * tree in the treebank.</summary>
         *
         * <returns>Created disambiguation corpus.</returns>
         */
        public DisambiguationCorpus Generate()
        {
            var corpus = new DisambiguationCorpus();

            for (var i = 0; i < _treeBank.Size(); i++)
            {
                var parseTree = _treeBank.Get(i);
                if (parseTree.LayerAll(ViewLayerType.INFLECTIONAL_GROUP))
                {
                    var sentence = parseTree.GenerateAnnotatedSentence();
                    var disambiguationSentence = new AnnotatedSentence.AnnotatedSentence("");
                    for (var j = 0; j < sentence.WordCount(); j++)
                    {
                        disambiguationSentence.AddWord(new DisambiguatedWord(sentence.GetWord(j).GetName(),
                                                                             ((AnnotatedWord)sentence.GetWord(j)).GetParse()));
                    }

                    corpus.AddSentence(sentence);
                }
            }

            return(corpus);
        }