public class Document extends SegmentedDocument implements IDocument
| Modifier and Type | Class and Description |
|---|---|
static class |
Document.Cache<T>
One-object cache
|
static class |
Document.MapCache<K,T>
Key-indexed objects cache
|
static class |
Document.MapCache2<K,K2 extends java.lang.Enum<K2>,T>
Two-tier key-indexed objects cache
|
static class |
Document.MapCache3<K,K2 extends java.lang.Enum<K2>,K3 extends java.lang.Enum<K3>,T>
Two-tier key-indexed objects cache
|
| Modifier and Type | Field and Description |
|---|---|
private Document.Cache<ACoreferences> |
coreferences
Coreference cache
|
protected IDocumentFactory |
documentFactory
Document factory
|
private Document.MapCache<java.lang.Integer,java.util.List<Entailment>> |
entailments
Entailments
|
private Document.MapCache<java.lang.Integer,AGrammaticalStructure> |
grammaticalStructures
Grammatical structure cache
|
private Document.MapCache<java.lang.Integer,ANamedEntities> |
namedEntities
Named Entities cache
|
private Document.MapCache<java.lang.Integer,AParseTree> |
parseTrees
Parse tree cache
|
private Document.MapCache<java.lang.Integer,APartsOfSpeech> |
poses
Parts-of-speech cache
|
private Document.MapCache<java.lang.Integer,ARelationDependents> |
relationDependents
Relation dependents cache
|
private static boolean |
REMOVE_NEW_LINES |
java.lang.String |
report
Status string
|
private Document.MapCache3<java.lang.Integer,TypedDependencyProvider,TypedDependencyMode,ASemanticGraph> |
semanticGraphs
Semantic graph cache
|
private Document.MapCache<java.lang.Integer,Sentiment> |
sentiments
Sentiment
|
Status |
status
Status per sentence
|
private Document.MapCache<java.lang.Integer,java.util.List<Token>> |
tokens |
private Document.MapCache<java.lang.Integer,java.util.List<Triple>> |
triples
Triples
|
private IView |
view |
isSegmented, text, url| Modifier | Constructor and Description |
|---|---|
|
Document(IDocumentFactory documentFactory,
java.lang.String text)
Constructor (do not call DocumentFactory yet, not assumed to be ready to provide service)
|
|
Document(IDocumentFactory documentFactory,
java.net.URL url)
Constructor (do not call DocumentFactory yet, not assumed to be ready to provide service)
|
private |
Document(IDocumentFactory documentFactory,
java.net.URL url,
java.lang.String text)
Private constructor (do not call DocumentFactory yet, not assumed to be ready to provide service)
|
| Modifier and Type | Method and Description |
|---|---|
void |
analyze(int sentenceIdx)
Analyze sentence
|
void |
clear()
Clear cached data
|
AAnalysis |
getAnalysis(int sentenceIdx)
Get (sentence) analysis artifact
|
ACoreferences |
getCoreferences()
Get coreferences artifact
|
ATypedDependencies |
getDerivedTypedDependencies(int sentenceIdx,
TypedDependencyProvider provider,
TypedDependencyMode mode)
Get typed dependencies derived from semantic graph
|
java.util.List<Entailment> |
getEntailments(int sentenceIdx)
Get entailments
|
AGrammaticalStructure |
getGrammaticalStructure(int sentenceIdx)
Get grammatical structure artifact
|
Graph<GraphNode,GraphEdge> |
getGraph(int sentenceIdx,
TypedDependencyProvider provider,
TypedDependencyMode mode)
Get graph to be displayed (default is semantic graph)
|
ANamedEntities |
getNamedEntities(int sentenceIdx)
Get named entities artifact
|
AParseTree |
getParseTree(int sentenceIdx)
Get parse artifact
|
java.lang.String |
getPos(int sentenceIdx,
Segment wordSegment)
Get pos
|
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
|
Sentiment |
getSentiment(int sentenceIdx)
Get sentiment
|
TypedDependencyMode[] |
getSupportedModes()
Get supported typed dependency modes
|
TypedDependencyProvider[] |
getSupportedProviders()
Get supported typed dependency providers
|
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
|
IView |
getView()
Get view
|
private static void |
handleException(java.lang.Exception e)
Handle exception
|
boolean |
isReady()
Is ready
|
void |
make()
Make document (this calls DocumentFactory, now assumed to be ready to provide service called after lock on server is acquired)
|
void |
parse(int sentenceIdx)
Parse sentence
|
private static java.lang.String |
preprocess(java.lang.String text0)
Preprocess
|
void |
processText()
Process text level information (like coreference)
|
static java.lang.String |
read(java.net.URL url)
Create document from URL
|
void |
recognize(int sentenceIdx)
Recognize sentence (parts-of-speech, named entities, sentiment)
|
void |
setView(IView view)
Set view
|
getCurrentSentenceIdx, getCurrentSentenceSegment, getPath, getSentenceCount, getSentences, getSentenceSegment, getString, getText, getWords, merge, merge, nextSentence, previousSentence, segment, sentenceToString, setSentenceIdx, split, split, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetSentenceCount, getSentences, getText, getWordsprivate static final boolean REMOVE_NEW_LINES
public Status status
public java.lang.String report
private final Document.MapCache<java.lang.Integer,java.util.List<Token>> tokens
private final Document.MapCache<java.lang.Integer,APartsOfSpeech> poses
private final Document.MapCache<java.lang.Integer,AParseTree> parseTrees
private final Document.MapCache<java.lang.Integer,AGrammaticalStructure> grammaticalStructures
private final Document.MapCache3<java.lang.Integer,TypedDependencyProvider,TypedDependencyMode,ASemanticGraph> semanticGraphs
private final Document.MapCache<java.lang.Integer,ARelationDependents> relationDependents
private final Document.MapCache<java.lang.Integer,ANamedEntities> namedEntities
private final Document.MapCache<java.lang.Integer,Sentiment> sentiments
private final Document.MapCache<java.lang.Integer,java.util.List<Entailment>> entailments
private final Document.MapCache<java.lang.Integer,java.util.List<Triple>> triples
private final Document.Cache<ACoreferences> coreferences
protected final IDocumentFactory documentFactory
private IView view
public Document(IDocumentFactory documentFactory, java.lang.String text)
documentFactory - document factorytext - document textpublic Document(IDocumentFactory documentFactory, java.net.URL url)
documentFactory - document factoryurl - document urlprivate Document(IDocumentFactory documentFactory, java.net.URL url, java.lang.String text)
documentFactory - document factoryurl - document urltext - document textpublic void make()
throws java.io.IOException
java.io.IOException - exceptionprivate static java.lang.String preprocess(java.lang.String text0)
text0 - raw textpublic static java.lang.String read(java.net.URL url)
throws java.io.IOException
url - source URLjava.io.IOException - exceptionpublic void clear()
IDocumentpublic boolean isReady()
IDocumentpublic void recognize(int sentenceIdx)
IDocumentpublic void parse(int sentenceIdx)
IDocumentpublic void analyze(int sentenceIdx)
IDocumentpublic void processText()
IDocumentprocessText in interface IDocumentpublic IView getView()
public void setView(IView view)
view - document's viewpublic java.util.List<Token> getTokens(int sentenceIdx) throws java.lang.RuntimeException
IDocumentFactoryServicegetTokens in interface IDocumentFactoryServicesentenceIdx - sentence indexjava.lang.RuntimeException - runtime exceptionpublic APartsOfSpeech getPoses(int sentenceIdx) throws java.lang.RuntimeException
IDocumentFactoryServicegetPoses in interface IDocumentFactoryServicesentenceIdx - sentence indexjava.lang.RuntimeExceptionpublic java.lang.String getPos(int sentenceIdx,
Segment wordSegment)
sentenceIdx - sentencewordSegment - wordpublic AParseTree getParseTree(int sentenceIdx)
IDocumentFactoryServicegetParseTree in interface IDocumentFactoryServicesentenceIdx - sentence indexpublic AGrammaticalStructure getGrammaticalStructure(int sentenceIdx)
IDocumentFactoryServicegetGrammaticalStructure in interface IDocumentFactoryServicesentenceIdx - sentence indexpublic ARelationDependents getRelationDependents(int sentenceIdx)
IDocumentFactoryServicegetRelationDependents in interface IDocumentFactoryServicesentenceIdx - sentence indexpublic java.util.Map<TypedDependencyProvider,java.util.Map<TypedDependencyMode,ATypedDependencies>> getTypedDependencies(int sentenceIdx) throws java.lang.RuntimeException
IDocumentFactoryServicegetTypedDependencies in interface IDocumentFactoryServicesentenceIdx - sentence indexjava.lang.RuntimeExceptionpublic ATypedDependencies getTypedDependencies(int sentenceIdx, TypedDependencyProvider provider, TypedDependencyMode mode)
IDocumentFactoryServicegetTypedDependencies in interface IDocumentFactoryServicesentenceIdx - sentence indexprovider - typed dependency providermode - typed dependency modepublic ASemanticGraph getSemanticGraph(int sentenceIdx, TypedDependencyProvider provider, TypedDependencyMode mode)
IDocumentFactoryServicegetSemanticGraph in interface IDocumentFactoryServicesentenceIdx - sentence indexprovider - typed dependency providermode - typed dependency modepublic java.util.Map<TypedDependencyProvider,java.util.Map<TypedDependencyMode,ASemanticGraph>> getSemanticGraphs(int sentenceIdx) throws java.lang.RuntimeException
IDocumentFactoryServicegetSemanticGraphs in interface IDocumentFactoryServicesentenceIdx - sentence indexjava.lang.RuntimeExceptionpublic ANamedEntities getNamedEntities(int sentenceIdx) throws java.lang.RuntimeException
IDocumentFactoryServicegetNamedEntities in interface IDocumentFactoryServicesentenceIdx - sentence indexjava.lang.RuntimeExceptionpublic Sentiment getSentiment(int sentenceIdx) throws java.lang.RuntimeException
IDocumentFactoryServicegetSentiment in interface IDocumentFactoryServicesentenceIdx - sentence indexjava.lang.RuntimeExceptionpublic java.util.List<Entailment> getEntailments(int sentenceIdx)
IDocumentFactoryServicegetEntailments in interface IDocumentFactoryServicesentenceIdx - sentence indexpublic java.util.List<Triple> getTriples(int sentenceIdx)
IDocumentFactoryServicegetTriples in interface IDocumentFactoryServicesentenceIdx - sentence indexpublic ACoreferences getCoreferences() throws java.lang.RuntimeException
IDocumentFactoryServicegetCoreferences in interface IDocumentFactoryServicejava.lang.RuntimeExceptionpublic AAnalysis getAnalysis(int sentenceIdx)
IDocumentFactoryServicegetAnalysis in interface IDocumentFactoryServicesentenceIdx - sentence indexpublic ATextAnalysis getTextAnalysis(TypedDependencyProvider provider, TypedDependencyMode mode) throws java.lang.RuntimeException
IDocumentFactoryServicegetTextAnalysis in interface IDocumentFactoryServiceprovider - providermode - modejava.lang.RuntimeExceptionpublic java.lang.String getTextReport(TypedDependencyProvider provider, TypedDependencyMode mode, boolean xMLModeFlag) throws java.lang.RuntimeException
IDocumentFactoryServicegetTextReport in interface IDocumentFactoryServiceprovider - providermode - modexMLModeFlag - XML format requestedjava.lang.RuntimeExceptionpublic java.lang.String[] getTextReports(TypedDependencyProvider provider, TypedDependencyMode mode, boolean xMLModeFlag) throws java.lang.RuntimeException
IDocumentFactoryServicegetTextReports in interface IDocumentFactoryServiceprovider - providermode - modexMLModeFlag - XML format requestedjava.lang.RuntimeExceptionpublic java.lang.String getReport(int sentenceIdx,
boolean xMLFlag)
IDocumentFactoryServicegetReport in interface IDocumentFactoryServicesentenceIdx - sentence indexxMLFlag - XML format requestedpublic java.lang.String[] getReports(int sentenceIdx,
boolean xMLFlag)
IDocumentFactoryServicegetReports in interface IDocumentFactoryServicesentenceIdx - sentence indexxMLFlag - XML format requestedpublic Graph<GraphNode,GraphEdge> getGraph(int sentenceIdx, TypedDependencyProvider provider, TypedDependencyMode mode)
sentenceIdx - sentence indexprovider - typed dependencies providermode - typed dependency modepublic ATypedDependencies getDerivedTypedDependencies(int sentenceIdx, TypedDependencyProvider provider, TypedDependencyMode mode)
sentenceIdx - sentence indexprovider - typed dependencies providermode - typed dependencies modeprivate static void handleException(java.lang.Exception e)
e - exceptionpublic TypedDependencyProvider[] getSupportedProviders()
IDocumentFactoryServicegetSupportedProviders in interface IDocumentFactoryServicepublic TypedDependencyMode[] getSupportedModes()
IDocumentFactoryServicegetSupportedModes in interface IDocumentFactoryService