public abstract class AbstractDocumentFactory extends java.lang.Object implements IDocumentFactory
Modifier and Type | Field and Description |
---|---|
private java.util.List<SentenceSegment> |
sentenceSegments
Sentence segments
|
protected java.lang.String |
text
Text
|
protected ATextAnalysis |
textAnalysis
Analysis
|
private java.util.List<WordSegment> |
wordSegments
Word segments
|
(package private) static XMLPrinter |
xMLPrinter
XML Printer
|
Constructor and Description |
---|
AbstractDocumentFactory()
Constructor
|
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
coreferencesToString(ACoreferences coreferences,
boolean isXml)
Coreferences to string
|
private static java.lang.String |
entailmentsToString(java.util.List<Entailment> entailments,
boolean isXml)
Entailments to string
|
private static java.util.List<WordSegment> |
flatten(java.util.List<java.util.List<WordSegment>> sentenceWordSegments)
Flatten hierarchical list of per-sentence word segments
|
AAnalysis |
getAnalysis(int sentenceIdx)
Get (sentence) analysis artifact
|
protected ACoreferences |
getArtifactCoreferences()
Get coreferences
|
protected java.util.List<Entailment> |
getArtifactEntailments(int sentenceIdx)
Get entailments
|
protected AGrammaticalStructure |
getArtifactGrammaticalStructure(int sentenceIdx)
Get grammatical structure
|
protected ANamedEntities |
getArtifactNamedEntities(int sentenceIdx)
Get named entities
|
protected AParseTree |
getArtifactParseTree(int sentenceIdx)
Get parse tree
|
protected Segmentation |
getArtifactSegmentation()
Get segmentation
|
protected ASemanticGraph |
getArtifactSemanticGraph(int sentenceIdx,
TypedDependencyProvider provider,
TypedDependencyMode mode)
Get semantic graph
|
protected java.util.Map<TypedDependencyProvider,java.util.Map<TypedDependencyMode,ASemanticGraph>> |
getArtifactSemanticGraphs(int sentenceIdx)
Get semantic graphs
|
protected Sentiment |
getArtifactSentiment(int sentenceIdx)
Get sentiment
|
protected java.util.List<Triple> |
getArtifactTriples(int sentenceIdx)
Get triples
|
protected ATypedDependencies |
getArtifactTypedDependencies(int sentenceIdx,
TypedDependencyProvider provider,
TypedDependencyMode mode)
Get typed dependencies
|
ACoreferences |
getCoreferences()
Get coreferences artifact
|
java.util.List<Entailment> |
getEntailments(int sentenceIdx)
Get entailments
|
AGrammaticalStructure |
getGrammaticalStructure(int sentenceIdx)
Get grammatical structure artifact
|
ANamedEntities |
getNamedEntities(int sentenceIdx)
Get named entities artifact
|
AParseTree |
getParseTree(int sentenceIdx)
Get parse artifact
|
APartsOfSpeech |
getPoses(int sentenceIdx)
Get parts-of-speech artifact
|
ARelationDependents |
getRelationDependents(int sentenceIdx)
Get relation dependents artifact
|
java.lang.String |
getReport(int sentenceIdx,
boolean xMLFlag)
Get (sentence) analysis string
|
java.lang.String[] |
getReports(int sentenceIdx,
boolean xMLFlag)
Get (sentence) analysis strings
|
ASemanticGraph |
getSemanticGraph(int sentenceIdx,
TypedDependencyProvider provider,
TypedDependencyMode mode)
Get semantic graph artifact
|
java.util.Map<TypedDependencyProvider,java.util.Map<TypedDependencyMode,ASemanticGraph>> |
getSemanticGraphs(int sentenceIdx)
Get semantic graph artifacts
|
int |
getSentenceCount()
Get sentence count
|
java.util.List<SentenceSegment> |
getSentences()
Get sentences
|
Sentiment |
getSentiment(int sentenceIdx)
Get sentiment
|
private static Segment |
getSpan(java.util.List<? extends Segment> segments)
Span
|
TypedDependencyMode[] |
getSupportedModes()
Get supported typed dependency modes
|
TypedDependencyProvider[] |
getSupportedProviders()
Get supported typed dependency providers
|
java.lang.String |
getText()
Get text
|
protected ATextAnalysis |
getTextAnalysis()
Get text analysis
|
ATextAnalysis |
getTextAnalysis(TypedDependencyProvider provider,
TypedDependencyMode mode)
Get text analysis
|
java.lang.String |
getTextReport(TypedDependencyProvider provider,
TypedDependencyMode mode,
boolean xMLModeFlag)
Get (text) analysis string
|
java.lang.String[] |
getTextReports(TypedDependencyProvider provider,
TypedDependencyMode mode,
boolean xMLModeFlag)
Get (text) analysis strings
|
java.util.List<Token> |
getTokens(int sentenceIdx)
Get tokens
|
java.util.List<Triple> |
getTriples(int sentenceIdx)
Get triples
|
java.util.Map<TypedDependencyProvider,java.util.Map<TypedDependencyMode,ATypedDependencies>> |
getTypedDependencies(int sentenceIdx)
Get typed dependencies artifact
|
ATypedDependencies |
getTypedDependencies(int sentenceIdx,
TypedDependencyProvider provider,
TypedDependencyMode mode)
Get typed dependencies artifact
|
java.util.List<WordSegment> |
getWords()
Get words
|
private static java.lang.String |
grammaticalStructureToString(AGrammaticalStructure grammaticalStructure,
boolean isXml)
Grammatical structure to string
|
private static java.util.List<SentenceSegment> |
groupToSentence(java.util.List<java.util.List<WordSegment>> sentenceWordSegments)
Make sentence segments and map : returns (list of segments, segment to list of words map)
|
boolean |
init(java.lang.String text)
Init processing
|
private static java.lang.String |
namedEntitiesToString(ANamedEntities namedEntities,
boolean isXml)
Named entities to string
|
abstract java.lang.String |
processText(java.lang.String text) |
private static java.lang.String |
semanticGraphsToString(java.util.Map<TypedDependencyProvider,java.util.Map<TypedDependencyMode,ASemanticGraph>> semanticGraphs,
boolean isXml)
Semantic graph to string
|
private static java.lang.String |
sentimentToString(Sentiment sentiment,
boolean isXml)
Sentiment to string
|
private static java.lang.String |
tokensToString(java.util.List<Token> tokens,
boolean isXml)
Tokens to string
|
private static java.lang.String |
treeToString(AParseTree parseTree,
boolean isXml)
Parse tree to string
|
private static java.lang.String |
triplesToString(java.util.List<Triple> triples,
boolean isXml)
Triples to string
|
private static java.lang.String |
typedDependenciesToString(java.util.Map<TypedDependencyProvider,java.util.Map<TypedDependencyMode,ASemanticGraph>> semanticGraphs,
boolean isXml)
Typed dependencies to string
|
static XMLPrinter xMLPrinter
protected ATextAnalysis textAnalysis
protected java.lang.String text
private java.util.List<WordSegment> wordSegments
private java.util.List<SentenceSegment> sentenceSegments
public boolean init(java.lang.String text)
IDocumentFactory
init
in interface IDocumentFactory
text
- input textprotected ATextAnalysis getTextAnalysis()
public TypedDependencyProvider[] getSupportedProviders() throws java.lang.RuntimeException
IDocumentFactoryService
getSupportedProviders
in interface IDocumentFactoryService
java.lang.RuntimeException
public TypedDependencyMode[] getSupportedModes() throws java.lang.RuntimeException
IDocumentFactoryService
getSupportedModes
in interface IDocumentFactoryService
java.lang.RuntimeException
public java.lang.String getText() throws java.lang.RuntimeException
IDocumentFactoryService
getText
in interface IDocumentFactoryService
java.lang.RuntimeException
public java.util.List<SentenceSegment> getSentences() throws java.lang.RuntimeException
IDocumentFactoryService
getSentences
in interface IDocumentFactoryService
java.lang.RuntimeException
public int getSentenceCount() throws java.lang.RuntimeException
IDocumentFactoryService
getSentenceCount
in interface IDocumentFactoryService
java.lang.RuntimeException
public java.util.List<WordSegment> getWords() throws java.lang.RuntimeException
IDocumentFactoryService
getWords
in interface IDocumentFactoryService
java.lang.RuntimeException
private static java.util.List<SentenceSegment> groupToSentence(java.util.List<java.util.List<WordSegment>> sentenceWordSegments)
sentenceWordSegments
- list of sentencesprivate static java.util.List<WordSegment> flatten(java.util.List<java.util.List<WordSegment>> sentenceWordSegments)
sentenceWordSegments
- hierarchical list of per-sentence word segmentsprivate static Segment getSpan(java.util.List<? extends Segment> segments)
segments
- segmentspublic java.util.List<Token> getTokens(int sentenceIdx) throws java.lang.RuntimeException
IDocumentFactoryService
getTokens
in interface IDocumentFactoryService
sentenceIdx
- sentence indexjava.lang.RuntimeException
- runtime exceptionpublic AParseTree getParseTree(int sentenceIdx) throws java.lang.RuntimeException
IDocumentFactoryService
getParseTree
in interface IDocumentFactoryService
sentenceIdx
- sentence indexjava.lang.RuntimeException
public APartsOfSpeech getPoses(int sentenceIdx) throws java.lang.RuntimeException
IDocumentFactoryService
getPoses
in interface IDocumentFactoryService
sentenceIdx
- sentence indexjava.lang.RuntimeException
public AGrammaticalStructure getGrammaticalStructure(int sentenceIdx) throws java.lang.RuntimeException
IDocumentFactoryService
getGrammaticalStructure
in interface IDocumentFactoryService
sentenceIdx
- sentence indexjava.lang.RuntimeException
public ARelationDependents getRelationDependents(int sentenceIdx) throws java.lang.RuntimeException
IDocumentFactoryService
getRelationDependents
in interface IDocumentFactoryService
sentenceIdx
- sentence indexjava.lang.RuntimeException
public ATypedDependencies getTypedDependencies(int sentenceIdx, TypedDependencyProvider provider, TypedDependencyMode mode) throws java.lang.RuntimeException
IDocumentFactoryService
getTypedDependencies
in interface IDocumentFactoryService
sentenceIdx
- sentence indexprovider
- typed dependency providermode
- typed dependency modejava.lang.RuntimeException
public java.util.Map<TypedDependencyProvider,java.util.Map<TypedDependencyMode,ATypedDependencies>> getTypedDependencies(int sentenceIdx) throws java.lang.RuntimeException
IDocumentFactoryService
getTypedDependencies
in interface IDocumentFactoryService
sentenceIdx
- sentence indexjava.lang.RuntimeException
public ASemanticGraph getSemanticGraph(int sentenceIdx, TypedDependencyProvider provider, TypedDependencyMode mode) throws java.lang.RuntimeException
IDocumentFactoryService
getSemanticGraph
in interface IDocumentFactoryService
sentenceIdx
- sentence indexprovider
- typed dependency providermode
- typed dependency modejava.lang.RuntimeException
public java.util.Map<TypedDependencyProvider,java.util.Map<TypedDependencyMode,ASemanticGraph>> getSemanticGraphs(int sentenceIdx) throws java.lang.RuntimeException
IDocumentFactoryService
getSemanticGraphs
in interface IDocumentFactoryService
sentenceIdx
- sentence indexjava.lang.RuntimeException
public ANamedEntities getNamedEntities(int sentenceIdx) throws java.lang.RuntimeException
IDocumentFactoryService
getNamedEntities
in interface IDocumentFactoryService
sentenceIdx
- sentence indexjava.lang.RuntimeException
public Sentiment getSentiment(int sentenceIdx)
IDocumentFactoryService
getSentiment
in interface IDocumentFactoryService
sentenceIdx
- sentence indexpublic java.util.List<Entailment> getEntailments(int sentenceIdx)
IDocumentFactoryService
getEntailments
in interface IDocumentFactoryService
sentenceIdx
- sentence indexpublic java.util.List<Triple> getTriples(int sentenceIdx)
IDocumentFactoryService
getTriples
in interface IDocumentFactoryService
sentenceIdx
- sentence indexpublic ACoreferences getCoreferences() throws java.lang.RuntimeException
IDocumentFactoryService
getCoreferences
in interface IDocumentFactoryService
java.lang.RuntimeException
public ATextAnalysis getTextAnalysis(TypedDependencyProvider provider, TypedDependencyMode mode) throws java.lang.RuntimeException
IDocumentFactoryService
getTextAnalysis
in interface IDocumentFactoryService
provider
- providermode
- modejava.lang.RuntimeException
public AAnalysis getAnalysis(int sentenceIdx) throws java.lang.RuntimeException
IDocumentFactoryService
getAnalysis
in interface IDocumentFactoryService
sentenceIdx
- sentence indexjava.lang.RuntimeException
public java.lang.String[] getReports(int sentenceIdx, boolean xMLFlag) throws java.lang.RuntimeException
IDocumentFactoryService
getReports
in interface IDocumentFactoryService
sentenceIdx
- sentence indexxMLFlag
- XML format requestedjava.lang.RuntimeException
public java.lang.String getReport(int sentenceIdx, boolean xMLFlag) throws java.lang.RuntimeException
IDocumentFactoryService
getReport
in interface IDocumentFactoryService
sentenceIdx
- sentence indexxMLFlag
- XML format requestedjava.lang.RuntimeException
public java.lang.String getTextReport(TypedDependencyProvider provider, TypedDependencyMode mode, boolean xMLModeFlag) throws java.lang.RuntimeException
IDocumentFactoryService
getTextReport
in interface IDocumentFactoryService
provider
- providermode
- modexMLModeFlag
- XML format requestedjava.lang.RuntimeException
public java.lang.String[] getTextReports(TypedDependencyProvider provider, TypedDependencyMode mode, boolean xMLModeFlag) throws java.lang.RuntimeException
IDocumentFactoryService
getTextReports
in interface IDocumentFactoryService
provider
- providermode
- modexMLModeFlag
- XML format requestedjava.lang.RuntimeException
private static java.lang.String tokensToString(java.util.List<Token> tokens, boolean isXml)
tokens
- tokensisXml
- xml formatprivate static java.lang.String treeToString(AParseTree parseTree, boolean isXml)
parseTree
- parse treeisXml
- xml formatprivate static java.lang.String grammaticalStructureToString(AGrammaticalStructure grammaticalStructure, boolean isXml)
grammaticalStructure
- grammatical structureisXml
- xml formatprivate static java.lang.String typedDependenciesToString(java.util.Map<TypedDependencyProvider,java.util.Map<TypedDependencyMode,ASemanticGraph>> semanticGraphs, boolean isXml)
semanticGraphs
- semantic graphsisXml
- xml formatprivate static java.lang.String semanticGraphsToString(java.util.Map<TypedDependencyProvider,java.util.Map<TypedDependencyMode,ASemanticGraph>> semanticGraphs, boolean isXml)
semanticGraphs
- semantic graphsisXml
- xml formatprivate static java.lang.String namedEntitiesToString(ANamedEntities namedEntities, boolean isXml)
namedEntities
- named entitiesisXml
- xml formatprivate static java.lang.String sentimentToString(Sentiment sentiment, boolean isXml)
sentiment
- sentimentisXml
- xml formatprivate static java.lang.String entailmentsToString(java.util.List<Entailment> entailments, boolean isXml)
entailments
- entailmentsisXml
- xml formatprivate static java.lang.String triplesToString(java.util.List<Triple> triples, boolean isXml)
triples
- triplesisXml
- xml formatprivate static java.lang.String coreferencesToString(ACoreferences coreferences, boolean isXml)
coreferences
- coreferencesisXml
- xml formatprotected Segmentation getArtifactSegmentation() throws java.lang.RuntimeException
java.lang.RuntimeException
- exceptionprotected AParseTree getArtifactParseTree(int sentenceIdx) throws java.lang.RuntimeException
sentenceIdx
- word list sentencejava.lang.RuntimeException
- exceptionprotected AGrammaticalStructure getArtifactGrammaticalStructure(int sentenceIdx) throws java.lang.RuntimeException
sentenceIdx
- sentencejava.lang.RuntimeException
protected ATypedDependencies getArtifactTypedDependencies(int sentenceIdx, TypedDependencyProvider provider, TypedDependencyMode mode) throws java.lang.RuntimeException
sentenceIdx
- sentenceprovider
- typed dependency providermode
- typed dependency modejava.lang.RuntimeException
- exceptionprotected ASemanticGraph getArtifactSemanticGraph(int sentenceIdx, TypedDependencyProvider provider, TypedDependencyMode mode) throws java.lang.RuntimeException
sentenceIdx
- sentenceprovider
- typed dependency providermode
- typed dependency modejava.lang.RuntimeException
protected java.util.Map<TypedDependencyProvider,java.util.Map<TypedDependencyMode,ASemanticGraph>> getArtifactSemanticGraphs(int sentenceIdx) throws java.lang.RuntimeException
sentenceIdx
- sentencejava.lang.RuntimeException
protected ANamedEntities getArtifactNamedEntities(int sentenceIdx) throws java.lang.RuntimeException
sentenceIdx
- sentence indexjava.lang.RuntimeException
- exceptionprotected Sentiment getArtifactSentiment(int sentenceIdx) throws java.lang.RuntimeException
sentenceIdx
- sentence indexjava.lang.RuntimeException
- exceptionprotected java.util.List<Entailment> getArtifactEntailments(int sentenceIdx)
sentenceIdx
- sentence indexjava.lang.RuntimeException
- exceptionprotected java.util.List<Triple> getArtifactTriples(int sentenceIdx)
sentenceIdx
- sentence indexjava.lang.RuntimeException
- exceptionprotected ACoreferences getArtifactCoreferences() throws java.lang.RuntimeException
java.lang.RuntimeException
public abstract java.lang.String processText(java.lang.String text) throws java.lang.Exception
java.lang.Exception