public enum DocumentCategory extends Enum<DocumentCategory> implements ElementCategory
This enumerated type defines the different types of components found in the structure of text. This deals exclusively with the structural format of the text and not of the syntax of the language. Therefore, this enumeration deals with documents, sections, paragraphs, sentences and lists.
The enumeration implements the ElementCategory interface, thus
making it compatible the SimpleNLG framework.
| Enum Constant and Description |
|---|
DOCUMENT
Definition for a document.
|
ENUMERATED_LIST
Definition for creating a list of enumerated items.
|
LIST
Definition for creating a list of items.
|
LIST_ITEM
Definition for an item in a list.
|
PARAGRAPH
Definition for a paragraph.
|
SECTION
Definition for a section within a document.
|
SENTENCE
Definition for a sentence.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equalTo(Object checkObject)
Checks to see if the given object is equal to this document category.
|
boolean |
hasSubPart(ElementCategory elementCategory)
This method determines if the supplied elementCategory forms an immediate
sub-part of
this category. |
static DocumentCategory |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static DocumentCategory[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final DocumentCategory DOCUMENT
public static final DocumentCategory SECTION
public static final DocumentCategory PARAGRAPH
public static final DocumentCategory SENTENCE
public static final DocumentCategory LIST
public static final DocumentCategory ENUMERATED_LIST
public static final DocumentCategory LIST_ITEM
public static DocumentCategory[] values()
for (DocumentCategory c : DocumentCategory.values()) System.out.println(c);
public static DocumentCategory valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic boolean equalTo(Object checkObject)
Checks to see if the given object is equal to this document category.
This is done by checking the enumeration if the object is of the type
DocumentCategory or by converting the object and the this
category to strings and comparing the strings.
For example, DocumentCategory.LIST will match another
DocumentCategory.LIST but will also match the string
"list" as well.
equalTo in interface ElementCategorycheckObject - the object to be checked against.true if the object matches, false
otherwise.public boolean hasSubPart(ElementCategory elementCategory)
This method determines if the supplied elementCategory forms an immediate
sub-part of this category. The allowed sub-parts for each
this type are outlined below:
NLGElements. It cannot contain DOCUMENTs, SECTIONs,
PARAGRAPHs, other SENTENCEs, LISTs, ENUMERATED_LISTs or LIST_ITEMs.NLGElements. It cannot contain DOCUMENTs, SECTIONs,
or LIST_ITEMs.For structuring text, this effectively becomes the test for relevant child types affecting the immediate children. For instance, it is possible for a DOCUMENT to contain LIST_ITEMs but only if the LIST_ITEMs are children of LISTs.
A more precise definition of SENTENCE would be that it only contains PHRASEs. However, this DocumentCategory does not consider these options as this crosses the boundary between orthographic structure and syntactic structure.
In pseudo-BNF this can be written as:
DOCUMENT ::= DOCUMENT_PART*
DOCUMENT_PART ::= SECTION | PARAGRAPH
SECTION ::= DOCUMENT_PART*
PARAGRAPH ::= PARAPGRAPH_PART*
PARAGRAPH_PART ::= SENTENCE | LIST | ENUMERATED_LIST
SENTENCE ::= <NLGElement>*
LIST ::= LIST_ITEM*
ENUMERATED_LIST::= LIST_ITEM*
LIST_ITEM ::= PARAGRAPH | PARAGRAPH_PART | <NLGElement>
Ideally the '*' should be replaced with '+' to represent that one or more
of the components must exist rather than 0 or more. However, the
implementation permits creation of the DocumentElements with
no children or sub-parts added.
elementCategory - the category we are checking against. If this is
NULL the method will return false.true if the supplied elementCategory is a sub-part
of this type of category, false
otherwise.Copyright © 2020. All Rights Reserved.