コード例 #1
0
 internal TripletWordGroup(Predicate predicate)
 {
     RawGroup = predicate;
     TextSpan = predicate.Name;
 }
コード例 #2
0
ファイル: TripletNLG.cs プロジェクト: m9ra/KnowledgeDialog2
        /// <summary>
        /// Gets auxiliary verb from given predicate if available.
        /// </summary>
        /// <param name="predicate">The predicate.</param>
        /// <returns>The auxiliary verb in same for as in predicate, <c>null</c> if such verb is not present.</returns>
        private string findAuxiliary(Predicate predicate)
        {
            var text = generate(predicate);
            var words = text.Split(' ');

            foreach (var word in words)
            {
                if (_auxiliaryVerbs.Contains(word))
                    return word;
            }

            return null;
        }
コード例 #3
0
ファイル: TripletNLG.cs プロジェクト: m9ra/KnowledgeDialog2
        /// <summary>
        /// Generates string representation predicate's part that can be
        /// used at begining of a question.
        /// </summary>
        /// <param name="predicate">The predicate.</param>
        /// <returns>The generated representation.</returns>
        private string generateQuestionPredicatePart(Predicate predicate)
        {
            var auxiliaryVerb = findAuxiliary(predicate);

            if (auxiliaryVerb == null)
                return "do";

            //questions begins with auxilar verb if possible
            return auxiliaryVerb;
        }
コード例 #4
0
ファイル: TripletNLG.cs プロジェクト: m9ra/KnowledgeDialog2
        /// <summary>
        /// Generates string representation predicate's part that can be
        /// used at begining of a question.
        /// </summary>
        /// <param name="predicate">The predicate.</param>
        /// <returns>The generated representation.</returns>
        private string generateDependentPredicatePart(Predicate predicate)
        {
            var predicateText = generate(predicate);
            var auxiliaryVerb = findAuxiliary(predicate);
            if (auxiliaryVerb == null)
                //whole predicate will be used
                return predicateText;

            return predicateText.Replace(auxiliaryVerb, "").Trim();
        }
コード例 #5
0
 /// <summary>
 /// Creates triplet with given subject, predicate and object.
 /// </summary>
 /// <param name="subject">The subject of triplet.</param>
 /// <param name="predicate">The predicate of triplet.</param>
 /// <param name="obj">The object of triplet.</param>
 /// <returns>The created triplet wrapped into an array.</returns>
 private IEnumerable<TripletTree> triplet(Entity subject, Predicate predicate, Entity obj)
 {
     return new[] { TripletTree.From(subject, predicate, obj) };
 }