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, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getSentenceCount, getSentences, getText, getWords
private 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()
IDocument
public boolean isReady()
IDocument
public void recognize(int sentenceIdx)
IDocument
public void parse(int sentenceIdx)
IDocument
public void analyze(int sentenceIdx)
IDocument
public void processText()
IDocument
processText
in interface IDocument
public IView getView()
public void setView(IView view)
view
- document's viewpublic java.util.List<Token> getTokens(int sentenceIdx) throws java.lang.RuntimeException
IDocumentFactoryService
getTokens
in interface IDocumentFactoryService
sentenceIdx
- sentence indexjava.lang.RuntimeException
- runtime exceptionpublic APartsOfSpeech getPoses(int sentenceIdx) throws java.lang.RuntimeException
IDocumentFactoryService
getPoses
in interface IDocumentFactoryService
sentenceIdx
- sentence indexjava.lang.RuntimeException
public java.lang.String getPos(int sentenceIdx, Segment wordSegment)
sentenceIdx
- sentencewordSegment
- wordpublic AParseTree getParseTree(int sentenceIdx)
IDocumentFactoryService
getParseTree
in interface IDocumentFactoryService
sentenceIdx
- sentence indexpublic AGrammaticalStructure getGrammaticalStructure(int sentenceIdx)
IDocumentFactoryService
getGrammaticalStructure
in interface IDocumentFactoryService
sentenceIdx
- sentence indexpublic ARelationDependents getRelationDependents(int sentenceIdx)
IDocumentFactoryService
getRelationDependents
in interface IDocumentFactoryService
sentenceIdx
- sentence indexpublic 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 ATypedDependencies getTypedDependencies(int sentenceIdx, TypedDependencyProvider provider, TypedDependencyMode mode)
IDocumentFactoryService
getTypedDependencies
in interface IDocumentFactoryService
sentenceIdx
- sentence indexprovider
- typed dependency providermode
- typed dependency modepublic ASemanticGraph getSemanticGraph(int sentenceIdx, TypedDependencyProvider provider, TypedDependencyMode mode)
IDocumentFactoryService
getSemanticGraph
in interface IDocumentFactoryService
sentenceIdx
- sentence indexprovider
- typed dependency providermode
- typed dependency modepublic 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) throws java.lang.RuntimeException
IDocumentFactoryService
getSentiment
in interface IDocumentFactoryService
sentenceIdx
- sentence indexjava.lang.RuntimeException
public 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 AAnalysis getAnalysis(int sentenceIdx)
IDocumentFactoryService
getAnalysis
in interface IDocumentFactoryService
sentenceIdx
- sentence indexpublic ATextAnalysis getTextAnalysis(TypedDependencyProvider provider, TypedDependencyMode mode) throws java.lang.RuntimeException
IDocumentFactoryService
getTextAnalysis
in interface IDocumentFactoryService
provider
- providermode
- modejava.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
public java.lang.String getReport(int sentenceIdx, boolean xMLFlag)
IDocumentFactoryService
getReport
in interface IDocumentFactoryService
sentenceIdx
- sentence indexxMLFlag
- XML format requestedpublic java.lang.String[] getReports(int sentenceIdx, boolean xMLFlag)
IDocumentFactoryService
getReports
in interface IDocumentFactoryService
sentenceIdx
- 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()
IDocumentFactoryService
getSupportedProviders
in interface IDocumentFactoryService
public TypedDependencyMode[] getSupportedModes()
IDocumentFactoryService
getSupportedModes
in interface IDocumentFactoryService