Esempio n. 1
0
        /// <summary>
        /// 谓语本身用途主要是是修饰主语,
        /// 如果符合要求则构建 :
        /// relation triple "state (s, t)"
        /// </summary>
        /// <param name="scenario"></param>
        /// <param name="samplingSentence"></param>
        /// <param name="subject"></param>
        /// <param name="predicate"></param>
        private void LabelingPredicate(edu.stanford.nlp.ling.IndexedWord subject, edu.stanford.nlp.ling.IndexedWord predicate, edu.stanford.nlp.ling.IndexedWord objective, edu.stanford.nlp.util.CoreMap samplingSentence, Scenario scenario)
        {
            string pos = predicate?.get(partOfSpeechAnnotationClass) as string;
            string key = "", relation = "", value = "";

            switch (pos)
            {
            //表示主语的状态和趋势
            case "VBD":
            case "VBG":
            case "VBN":
            case "VBP":
            case "VBZ":
            {
                if (objective == null)
                {
                    key      = subject.value();
                    relation = "state";
                    value    = predicate.value();
                }
                else
                {
                    key      = subject.value();
                    relation = predicate.value();
                    value    = objective.value();
                }
            }
            break;

            default:
                LabelingModifiers(predicate, samplingSentence, scenario);
                break;
            }
            IScenarioFactor fa = scenario.ClusterFactor(relation, key, value);

            if (fa != null)
            {
                scenario.MergeValue(relation, key, value, fa);
            }
        }