Ejemplo n.º 1
0
        /**
         * Creates a sentence with the given subject, verb and direct object. The
         * phrase factory is used to construct a clause that then forms the
         * components of the sentence.
         *
         * @param subject
         *            the subject of the sentence.
         * @param verb
         *            the verb of the sentence.
         * @param complement
         *            the object of the sentence.
         * @return a <code>DocumentElement</code> representing this sentence
         */
        public virtual DocumentElement createSentence(object subject, object verb, object complement)
        {
            DocumentElement sentence = new DocumentElement(new DocumentCategory(DocumentCategory.DocumentCategoryEnum.SENTENCE), null);

            sentence.addComponent(createClause(subject, verb, complement));
            return(sentence);
        }
Ejemplo n.º 2
0
        /**
         * Creates a new sentence element
         *
         * @param components
         *            an <code>NLGElement</code> that becomes the first component of
         *            this document element.
         * @return a <code>DocumentElement</code> representing this sentence
         */
        public virtual DocumentElement createSentence(NLGElement components)
        {
            DocumentElement sentence = new DocumentElement(new DocumentCategory(DocumentCategory.DocumentCategoryEnum.SENTENCE), null);

            sentence.addComponent(components);
            return(sentence);
        }
Ejemplo n.º 3
0
        /**
         * Creates a list item for adding to a list element. The list item has the
         * given component.
         *
         * @return a <code>DocumentElement</code> representing the list item.
         */
        public virtual DocumentElement createListItem(NLGElement component)
        {
            DocumentElement listItem = new DocumentElement(new DocumentCategory(DocumentCategory.DocumentCategoryEnum.LIST_ITEM), null);

            listItem.addComponent(component);
            return(listItem);
        }
Ejemplo n.º 4
0
        /**
         * Creates a new section element with the given title and adds the given
         * component.
         *
         * @param component
         *            an <code>NLGElement</code> that becomes the first component of
         *            this document element.
         * @return a <code>DocumentElement</code> representing the section.
         * @author Rodrigo de Oliveira - Data2Text Ltd
         */
        public virtual DocumentElement createEnumeratedList(NLGElement component)
        {
            DocumentElement list = new DocumentElement(new DocumentCategory(DocumentCategory.DocumentCategoryEnum.ENUMERATED_LIST), null);

            list.addComponent(component);
            return(list);
        }
Ejemplo n.º 5
0
        /**
         * Creates a new document element with the given title and adds the given
         * component.
         *
         * @param title
         *            the title for this element.
         * @param component
         *            an <code>NLGElement</code> that becomes the first component of
         *            this document element.
         * @return a <code>DocumentElement</code>
         */
        public virtual DocumentElement createDocument(string title, NLGElement component)
        {
            DocumentElement element = new DocumentElement(new DocumentCategory(DocumentCategory.DocumentCategoryEnum.DOCUMENT), title);

            if (component != null)
            {
                element.addComponent(component);
            }
            return(element);
        }
Ejemplo n.º 6
0
        /**
         * Creates a new sentence with the given canned text. The canned text is
         * used to form a canned phrase (from the phrase factory) which is then
         * added as the component to sentence element.
         *
         * @param cannedSentence
         *            the canned text as a <code>String</code>.
         * @return a <code>DocumentElement</code> representing this sentence
         */
        public virtual DocumentElement createSentence(string cannedSentence)
        {
            DocumentElement sentence = new DocumentElement(new DocumentCategory(DocumentCategory.DocumentCategoryEnum.SENTENCE), null);

            if (!ReferenceEquals(cannedSentence, null))
            {
                sentence.addComponent(createStringElement(cannedSentence));
            }
            return(sentence);
        }
Ejemplo n.º 7
0
        /**
         * Creates a new section element with the given title and adds the given
         * component.
         *
         * @param title
         *            the title for this element.
         * @param component
         *            an <code>NLGElement</code> that becomes the first component of
         *            this document element.
         * @return a <code>DocumentElement</code> representing the section.
         */
        public virtual DocumentElement createSection(string title, NLGElement component)
        {
            DocumentElement section = new DocumentElement(new DocumentCategory(DocumentCategory.DocumentCategoryEnum.SECTION), title);

            if (component != null)
            {
                section.addComponent(component);
            }
            return(section);
        }
Ejemplo n.º 8
0
        /**
         * Creates a new paragraph element and adds the given component
         *
         * @param component
         *            an <code>NLGElement</code> that becomes the first component of
         *            this document element.
         * @return a <code>DocumentElement</code> representing this paragraph
         */
        public virtual DocumentElement createParagraph(NLGElement component)
        {
            DocumentElement paragraph = new DocumentElement(new DocumentCategory(DocumentCategory.DocumentCategoryEnum.PARAGRAPH), null);

            if (component != null)
            {
                paragraph.addComponent(component);
            }
            return(paragraph);
        }