public class Sentence
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
Document |
document
The document this sentence is derived from
|
Modifier | Constructor and Description |
---|---|
protected |
Sentence(java.util.function.BiFunction<java.util.Properties,java.lang.String,Document> docFn,
CoreNLPProtos.Sentence proto,
java.util.Properties props)
Create a sentence from a saved protocol buffer.
|
|
Sentence(CoreMap sentence)
Convert a CoreMap into a simple Sentence object.
|
|
Sentence(CoreNLPProtos.Sentence proto)
Create a sentence from a saved protocol buffer.
|
protected |
Sentence(Document doc,
CoreMap sentence)
Helper for creating a sentence from a document and a CoreMap representation
|
protected |
Sentence(Document doc,
CoreNLPProtos.Sentence.Builder proto,
java.util.Properties defaultProps)
The canonical constructor of a sentence from a
Document . |
protected |
Sentence(Document doc,
int sentenceIndex)
Helper for creating a sentence from a document at a given index
|
protected |
Sentence(Document doc,
java.util.Properties props)
Create a new sentence, using the specified properties as the default properties.
|
protected |
Sentence(java.util.function.Function<java.lang.String,Document> doc,
java.util.List<java.lang.String> tokens,
java.util.Properties props)
The actual implementation of a tokenized sentence constructor
|
|
Sentence(java.util.List<java.lang.String> tokens)
Create a new sentence from the given tokenized text, assuming the entire text is just one sentence.
|
|
Sentence(SentenceFragment sentence)
Convert a sentence fragment (i.e., entailed sentence) into a simple sentence object.
|
|
Sentence(java.lang.String text)
Create a new sentence from the given text, assuming the entire text is just one sentence.
|
|
Sentence(java.lang.String text,
java.util.Properties props)
Create a new sentence from some text, and some properties.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
after()
The whitespace after each token in the sentence.
|
java.lang.String |
after(int index)
The whitespace after this token in the sentence.
|
SentenceAlgorithms |
algorithms()
Return a class that can perform common algorithms on this sentence.
|
java.util.List<CoreLabel> |
asCoreLabels(java.util.function.Function<Sentence,java.lang.Object>... functions)
Returns this sentence as a list of CoreLabels representing the sentence.
|
CoreMap |
asCoreMap(java.util.function.Function<Sentence,java.lang.Object>... functions)
Returns this sentence as a CoreNLP CoreMap object.
|
java.util.List<java.lang.String> |
before()
The whitespace before each token in the sentence.
|
java.lang.String |
before(int index)
The whitespace before this token in the sentence.
|
Sentence |
cased()
Make this sentence case sensitive.
|
Sentence |
caseless()
Make this sentence caseless.
|
java.util.List<java.lang.Integer> |
characterOffsetBegin()
The character offset of each token in the sentence, as per
CoreLabel.beginPosition() . |
int |
characterOffsetBegin(int index)
The character offset of the given index in the sentence.
|
java.util.List<java.lang.Integer> |
characterOffsetEnd()
The end character offset of each token in the sentence, as per
CoreLabel.endPosition() . |
int |
characterOffsetEnd(int index)
The end character offset of the given index in the sentence.
|
java.util.Map<java.lang.Integer,CorefChain> |
coref()
Get the coreference chain for just this sentence.
|
SemanticGraph |
dependencyGraph() |
SemanticGraph |
dependencyGraph(java.util.Properties props) |
SemanticGraph |
dependencyGraph(java.util.Properties props,
SemanticGraphFactory.Mode mode)
Returns the dependency graph of the sentence, as a raw
SemanticGraph object. |
SemanticGraph |
dependencyGraph(SemanticGraphFactory.Mode mode) |
static Sentence |
deserialize(java.io.InputStream in)
Read a sentence from an input stream.
|
boolean |
equals(java.lang.Object o) |
<T> java.util.List<T> |
find(java.lang.String pattern,
java.util.function.Function<TokenSequenceMatcher,T> fn) |
<T> java.util.List<T> |
find(TokenSequencePattern pattern,
java.util.function.Function<TokenSequenceMatcher,T> fn)
Apply a TokensRegex pattern to the sentence.
|
java.util.Optional<java.lang.Integer> |
governor(int index) |
java.util.Optional<java.lang.Integer> |
governor(int index,
SemanticGraphFactory.Mode mode) |
java.util.Optional<java.lang.Integer> |
governor(java.util.Properties props,
int index) |
java.util.Optional<java.lang.Integer> |
governor(java.util.Properties props,
int index,
SemanticGraphFactory.Mode mode)
Returns the governor of the given index, according to the passed dependency type.
|
java.util.List<java.util.Optional<java.lang.Integer>> |
governors() |
java.util.List<java.util.Optional<java.lang.Integer>> |
governors(java.util.Properties props) |
java.util.List<java.util.Optional<java.lang.Integer>> |
governors(java.util.Properties props,
SemanticGraphFactory.Mode mode)
Returns the governors of a sentence, according to the passed dependency type.
|
java.util.List<java.util.Optional<java.lang.Integer>> |
governors(SemanticGraphFactory.Mode mode) |
int |
hashCode() |
java.util.Optional<java.lang.String> |
incomingDependencyLabel(int index) |
java.util.Optional<java.lang.String> |
incomingDependencyLabel(int index,
SemanticGraphFactory.Mode mode) |
java.util.Optional<java.lang.String> |
incomingDependencyLabel(java.util.Properties props,
int index) |
java.util.Optional<java.lang.String> |
incomingDependencyLabel(java.util.Properties props,
int index,
SemanticGraphFactory.Mode mode)
Returns the incoming dependency label to a particular index, according to the Basic Dependencies.
|
java.util.List<java.util.Optional<java.lang.String>> |
incomingDependencyLabels() |
java.util.List<java.util.Optional<java.lang.String>> |
incomingDependencyLabels(java.util.Properties props) |
java.util.List<java.util.Optional<java.lang.String>> |
incomingDependencyLabels(java.util.Properties props,
SemanticGraphFactory.Mode mode) |
java.util.List<java.util.Optional<java.lang.String>> |
incomingDependencyLabels(SemanticGraphFactory.Mode mode) |
java.util.Collection<Quadruple<java.lang.String,java.lang.String,java.lang.String,java.lang.Double>> |
kbp()
Get a list of KBP triples as flat (subject, relation, object, confidence) quadruples.
|
java.util.Collection<RelationTriple> |
kbpTriples() |
java.util.Collection<RelationTriple> |
kbpTriples(java.util.Properties props)
Get the KBP triples associated with this sentence.
|
java.lang.String |
lemma(int index) |
java.util.List<java.lang.String> |
lemmas() |
java.util.List<java.lang.String> |
lemmas(java.util.Properties props)
The lemmas of the sentence.
|
int |
length()
The length of the sentence, in tokens
|
boolean |
matches(java.lang.String pattern)
Apply a TokensRegex pattern to the sentence.
|
boolean |
matches(TokenSequencePattern pattern)
Apply a TokensRegex pattern to the sentence.
|
java.util.List<java.lang.String> |
mentions()
Get all mentions of any NER tag, as a list of surface forms.
|
java.util.List<java.lang.String> |
mentions(java.lang.String nerTag)
Get all mentions of the given NER tag, as a list of surface forms.
|
java.util.List<Polarity> |
natlogPolarities() |
java.util.List<Polarity> |
natlogPolarities(java.util.Properties props)
The Natural Logic notion of polarity for each token in a sentence.
|
Polarity |
natlogPolarity(int index) |
Polarity |
natlogPolarity(java.util.Properties props,
int index)
Get the polarity (the Natural Logic notion of polarity) for a given token in the sentence.
|
java.lang.String |
nerTag(int index) |
java.util.List<java.lang.String> |
nerTags() |
java.util.List<java.lang.String> |
nerTags(java.util.Properties props)
The named entity tags of the sentence.
|
java.util.Collection<Quadruple<java.lang.String,java.lang.String,java.lang.String,java.lang.Double>> |
openie()
Get a list of Open IE triples as flat (subject, relation, object, confidence) quadruples.
|
java.util.Collection<RelationTriple> |
openieTriples() |
java.util.Collection<RelationTriple> |
openieTriples(java.util.Properties props)
Get the OpenIE triples associated with this sentence.
|
java.util.Optional<OperatorSpec> |
operatorAt(int i) |
java.util.Optional<OperatorSpec> |
operatorAt(java.util.Properties props,
int i) |
java.util.List<java.util.Optional<OperatorSpec>> |
operators() |
java.util.List<java.util.Optional<OperatorSpec>> |
operators(java.util.Properties props)
Get a list of the (possible) Natural Logic operators on each node of the sentence.
|
java.util.List<OperatorSpec> |
operatorsNonempty() |
java.util.List<OperatorSpec> |
operatorsNonempty(java.util.Properties props)
Returns the list of non-empty Natural Logic operator specifications.
|
java.lang.String |
originalText(int index)
The original word at the given index.
|
java.util.List<java.lang.String> |
originalTexts()
The original (unprocessed) words of the sentence, as per
CoreLabel.originalText() . |
Tree |
parse() |
Tree |
parse(java.util.Properties props)
Returns the constituency parse of this sentence.
|
java.lang.String |
posTag(int index) |
java.util.List<java.lang.String> |
posTags() |
java.util.List<java.lang.String> |
posTags(java.util.Properties props)
The part of speech tags of the sentence.
|
CoreNLPProtos.Sentence.Builder |
rawSentence()
Get the backing protocol buffer for this sentence.
|
CoreNLPProtos.Token.Builder |
rawToken(int i)
A helper to get the raw Protobuf builder for a given token.
|
void |
regexner(java.lang.String mappingFile,
boolean ignorecase)
Run RegexNER over this sentence.
|
<T> java.util.List<T> |
semgrex(SemgrexPattern pattern,
java.util.function.Function<SemgrexMatcher,T> fn)
Apply a semgrex pattern to the sentence
|
<T> java.util.List<T> |
semgrex(java.lang.String pattern,
java.util.function.Function<SemgrexMatcher,T> fn)
Apply a semgrex pattern to the sentence
|
java.util.Optional<java.lang.String> |
sentenceid()
Returns the sentence id of the sentence, if one was found
|
int |
sentenceIndex()
The index of the sentence within the document.
|
int |
sentenceTokenOffsetBegin()
THe token offset of the sentence within the document.
|
int |
sentenceTokenOffsetEnd()
The token offset of the end of this sentence within the document.
|
SentimentClass |
sentiment()
The sentiment of this sentence (e.g., positive / negative).
|
SentimentClass |
sentiment(java.util.Properties props)
The sentiment of this sentence (e.g., positive / negative).
|
CoreNLPProtos.Sentence |
serialize()
Serialize the given sentence (but not the associated document!) into a Protocol Buffer.
|
void |
serialize(java.io.OutputStream out)
Write this sentence to an output stream.
|
java.lang.String |
substring(int start,
int end) |
java.lang.String |
text()
The raw text of the sentence, as input by, e.g.,
Sentence(String) . |
java.util.List<Token> |
tokens()
The tokens in this sentence.
|
java.lang.String |
toString() |
protected void |
updateDependencies(CoreNLPProtos.DependencyGraph basic,
CoreNLPProtos.DependencyGraph enhanced,
CoreNLPProtos.DependencyGraph enhancedPlusPlus)
Update the dependencies of the sentence.
|
protected void |
updateKBP(java.util.stream.Stream<CoreNLPProtos.RelationTriple> triples)
Update the Open IE relation triples for this sentence.
|
protected void |
updateOpenIE(java.util.stream.Stream<CoreNLPProtos.RelationTriple> triples)
Update the Open IE relation triples for this sentence.
|
protected void |
updateParse(CoreNLPProtos.ParseTree parse,
CoreNLPProtos.ParseTree binary)
Update the parse tree for this sentence.
|
protected void |
updateSentiment(java.lang.String sentiment)
Update the Sentiment class for this sentence.
|
protected <E> void |
updateTokens(java.util.List<CoreLabel> tokens,
java.util.function.Consumer<Pair<CoreNLPProtos.Token.Builder,E>> setter,
java.util.function.Function<CoreLabel,E> getter)
Update each token in the sentence with the given information.
|
java.lang.String |
word(int index)
The word at the given index of the sentence.
|
java.util.List<java.lang.String> |
words()
The words of the sentence, as per
CoreLabel.word() . |
public final Document document
protected Sentence(Document doc, java.util.Properties props)
doc
- The document to link this sentence to.props
- The properties to use for tokenizing the sentence.public Sentence(java.lang.String text, java.util.Properties props)
text
- The text of the sentence.props
- The properties to use for the annotators.public Sentence(java.lang.String text)
text
- The text of the sentence.protected Sentence(java.util.function.Function<java.lang.String,Document> doc, java.util.List<java.lang.String> tokens, java.util.Properties props)
public Sentence(java.util.List<java.lang.String> tokens)
tokens
- The text of the sentence.protected Sentence(java.util.function.BiFunction<java.util.Properties,java.lang.String,Document> docFn, CoreNLPProtos.Sentence proto, java.util.Properties props)
public Sentence(CoreNLPProtos.Sentence proto)
protected Sentence(Document doc, int sentenceIndex)
protected Sentence(Document doc, CoreNLPProtos.Sentence.Builder proto, java.util.Properties defaultProps)
Document
.doc
- The document to link this sentence to.proto
- The sentence implementation to use for this sentence.protected Sentence(Document doc, CoreMap sentence)
public Sentence(CoreMap sentence)
Sentence
object.sentence
- The CoreMap representation of the sentence.public Sentence(SentenceFragment sentence)
Sentence(CoreMap)
, this copies the information in the fragment into the underlying
protobuf backed format.sentence
- The sentence fragment to convert.public Sentence caseless()
public Sentence cased()
caseless()
.public CoreNLPProtos.Sentence serialize()
public void serialize(java.io.OutputStream out) throws java.io.IOException
out
- The output stream to write to. The stream is not closed after the method returns.java.io.IOException
- Thrown from the underlying write() implementation.public static Sentence deserialize(java.io.InputStream in) throws java.io.IOException
in
- The input stream to deserialize from.java.io.IOException
- Thrown by the underlying parse() implementation.Document.serialize(java.io.OutputStream)
public SentenceAlgorithms algorithms()
public java.lang.String text()
Sentence(String)
.public int sentenceIndex()
public int sentenceTokenOffsetBegin()
public int sentenceTokenOffsetEnd()
public java.util.List<java.lang.String> words()
CoreLabel.word()
.public java.lang.String word(int index)
public java.util.List<java.lang.String> originalTexts()
CoreLabel.originalText()
.public java.lang.String originalText(int index)
public java.util.List<java.lang.Integer> characterOffsetBegin()
CoreLabel.beginPosition()
.public int characterOffsetBegin(int index)
public java.util.List<java.lang.Integer> characterOffsetEnd()
CoreLabel.endPosition()
.public int characterOffsetEnd(int index)
public java.util.List<java.lang.String> before()
after()
of the previous token.public java.lang.String before(int index)
after()
of the previous token.public java.util.List<java.lang.String> after()
before()
of the next token.public java.lang.String after(int index)
before()
of the next token.public java.util.List<Token> tokens()
public java.util.List<java.lang.String> posTags(java.util.Properties props)
props
- The properties to use for the POSTaggerAnnotator
.public java.util.List<java.lang.String> posTags()
posTags(java.util.Properties)
public java.lang.String posTag(int index)
posTags(java.util.Properties)
public java.util.List<java.lang.String> lemmas(java.util.Properties props)
props
- The properties to use for the MorphaAnnotator
.public java.util.List<java.lang.String> lemmas()
lemmas(java.util.Properties)
public java.lang.String lemma(int index)
lemmas(java.util.Properties)
public java.util.List<java.lang.String> nerTags(java.util.Properties props)
props
- The properties to use for the NERCombinerAnnotator
.public java.util.List<java.lang.String> nerTags()
nerTags(java.util.Properties)
public void regexner(java.lang.String mappingFile, boolean ignorecase)
mappingFile
- The regexner mapping file.ignorecase
- If true, run a caseless match on the regexner file.public java.lang.String nerTag(int index)
nerTags(java.util.Properties)
public java.util.List<java.lang.String> mentions(java.lang.String nerTag)
nerTag
- The ner tag to search for, case sensitive.word(int)
function.public java.util.List<java.lang.String> mentions()
word(int)
function.public Tree parse(java.util.Properties props)
props
- The properties to use in the parser annotator.public Tree parse()
parse(java.util.Properties)
public java.util.Optional<java.lang.Integer> governor(java.util.Properties props, int index, SemanticGraphFactory.Mode mode)
props
- The properties to use in the parser annotator.index
- The index of the dependent word ZERO INDEXED. That is, the first word of the sentence
is index 0, not 1 as it would be in the SemanticGraph
framework.mode
- The type of dependency to use (e.g., basic, collapsed, collapsed cc processed).public java.util.Optional<java.lang.Integer> governor(java.util.Properties props, int index)
public java.util.Optional<java.lang.Integer> governor(int index, SemanticGraphFactory.Mode mode)
public java.util.Optional<java.lang.Integer> governor(int index)
governor(java.util.Properties, int)
public java.util.List<java.util.Optional<java.lang.Integer>> governors(java.util.Properties props, SemanticGraphFactory.Mode mode)
props
- The properties to use in the parser annotator.mode
- The type of dependency to use (e.g., basic, collapsed, collapsed cc processed).public java.util.List<java.util.Optional<java.lang.Integer>> governors(java.util.Properties props)
public java.util.List<java.util.Optional<java.lang.Integer>> governors(SemanticGraphFactory.Mode mode)
public java.util.List<java.util.Optional<java.lang.Integer>> governors()
public java.util.Optional<java.lang.String> incomingDependencyLabel(java.util.Properties props, int index, SemanticGraphFactory.Mode mode)
props
- The properties to use in the parser annotator.index
- The index of the dependent word ZERO INDEXED. That is, the first word of the sentence
is index 0, not 1 as it would be in the SemanticGraph
framework.mode
- The type of dependency to use (e.g., basic, collapsed, collapsed cc processed).public java.util.Optional<java.lang.String> incomingDependencyLabel(java.util.Properties props, int index)
public java.util.Optional<java.lang.String> incomingDependencyLabel(int index, SemanticGraphFactory.Mode mode)
public java.util.Optional<java.lang.String> incomingDependencyLabel(int index)
public java.util.List<java.util.Optional<java.lang.String>> incomingDependencyLabels(java.util.Properties props, SemanticGraphFactory.Mode mode)
public java.util.List<java.util.Optional<java.lang.String>> incomingDependencyLabels(SemanticGraphFactory.Mode mode)
public java.util.List<java.util.Optional<java.lang.String>> incomingDependencyLabels(java.util.Properties props)
public java.util.List<java.util.Optional<java.lang.String>> incomingDependencyLabels()
public SemanticGraph dependencyGraph(java.util.Properties props, SemanticGraphFactory.Mode mode)
SemanticGraph
object.
Note that this method is slower than you may expect, as it has to convert the underlying protocol
buffer back into a list of CoreLabels with which to populate the SemanticGraph
.props
- The properties to use for running the dependency parser annotator.mode
- The type of graph to return (e.g., basic, collapsed, etc).public SemanticGraph dependencyGraph(java.util.Properties props)
public SemanticGraph dependencyGraph()
public SemanticGraph dependencyGraph(SemanticGraphFactory.Mode mode)
public int length()
public java.util.List<java.util.Optional<OperatorSpec>> operators(java.util.Properties props)
props
- The properties to pass to the natural logic annotator.public java.util.List<java.util.Optional<OperatorSpec>> operators()
operators(Properties)
public java.util.Optional<OperatorSpec> operatorAt(java.util.Properties props, int i)
operators(Properties)
public java.util.Optional<OperatorSpec> operatorAt(int i)
operators(Properties)
public java.util.List<OperatorSpec> operatorsNonempty(java.util.Properties props)
OperatorSpec.quantifierBegin
and
OperatorSpec.quantifierEnd
.props
- The properties to use for the natlog annotator.public java.util.List<OperatorSpec> operatorsNonempty()
operatorsNonempty(Properties)
public java.util.List<Polarity> natlogPolarities(java.util.Properties props)
props
- The properties to use for the natural logic annotator.public java.util.List<Polarity> natlogPolarities()
natlogPolarities(Properties)
public Polarity natlogPolarity(java.util.Properties props, int index)
props
- The properties to use for the natural logic annotator.index
- The index to return the polarity of.public Polarity natlogPolarity(int index)
natlogPolarity(Properties, int)
public java.util.Collection<RelationTriple> openieTriples(java.util.Properties props)
CoreLabel
s.props
- The properties to use for the OpenIE annotator.RelationTriple
objects representing the OpenIE triples in the sentence.public java.util.Collection<RelationTriple> openieTriples()
Sentence@openieTriples(Properties)
public java.util.Collection<Quadruple<java.lang.String,java.lang.String,java.lang.String,java.lang.Double>> openie()
RelationTriple
objects, as it doesn't
require converting the underlying representation into CoreLabel
s; but, it also contains
significantly less information about the sentence.Sentence@openieTriples(Properties)
public java.util.Collection<RelationTriple> kbpTriples(java.util.Properties props)
CoreLabel
s.props
- The properties to use for the KBP annotator.RelationTriple
objects representing the KBP triples in the sentence.public java.util.Collection<RelationTriple> kbpTriples()
Sentence@kbpTriples(Properties)
public java.util.Collection<Quadruple<java.lang.String,java.lang.String,java.lang.String,java.lang.Double>> kbp()
RelationTriple
objects, as it doesn't
require converting the underlying representation into CoreLabel
s; but, it also contains
significantly less information about the sentence.Sentence@kbpTriples(Properties)
public SentimentClass sentiment()
SentimentClass
of this sentence, as an enum value.public SentimentClass sentiment(java.util.Properties props)
props
- The properties to pass to the sentiment classifier.SentimentClass
of this sentence, as an enum value.public java.util.Map<java.lang.Integer,CorefChain> coref()
@SafeVarargs public final CoreMap asCoreMap(java.util.function.Function<Sentence,java.lang.Object>... functions)
functions
- A list of functions to call before populating the CoreMap.
For example, you can specify mySentence::posTags, and then posTags will
be populated.@SafeVarargs public final java.util.List<CoreLabel> asCoreLabels(java.util.function.Function<Sentence,java.lang.Object>... functions)
functions
- A list of functions to call before populating the CoreMap.
For example, you can specify mySentence::posTags, and then posTags will
be populated.public CoreNLPProtos.Token.Builder rawToken(int i)
i
- The index of the token to retrieve.public CoreNLPProtos.Sentence.Builder rawSentence()
protected <E> void updateTokens(java.util.List<CoreLabel> tokens, java.util.function.Consumer<Pair<CoreNLPProtos.Token.Builder,E>> setter, java.util.function.Function<CoreLabel,E> getter)
E
- The type of the given field we are setting in the protocol buffer and reading from the CoreLabel
.tokens
- The CoreNLP tokens returned by the Annotator
.setter
- The function to set a Protobuf object with the given field.getter
- The function to get the given field from the CoreLabel
.protected void updateParse(CoreNLPProtos.ParseTree parse, CoreNLPProtos.ParseTree binary)
parse
- The parse tree to update.binary
- The binary parse tree to update.protected void updateDependencies(CoreNLPProtos.DependencyGraph basic, CoreNLPProtos.DependencyGraph enhanced, CoreNLPProtos.DependencyGraph enhancedPlusPlus)
basic
- The basic dependencies to update.enhanced
- The enhanced dependencies to update.enhancedPlusPlus
- The enhanced plus plus dependencies to update.protected void updateOpenIE(java.util.stream.Stream<CoreNLPProtos.RelationTriple> triples)
triples
- The stream of relation triples to add to the sentence.protected void updateKBP(java.util.stream.Stream<CoreNLPProtos.RelationTriple> triples)
triples
- The stream of relation triples to add to the sentence.protected void updateSentiment(java.lang.String sentiment)
sentiment
- The sentiment of the sentence.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String substring(int start, int end)
start
- - inclusiveend
- - exclusivepublic java.util.Optional<java.lang.String> sentenceid()
public boolean matches(TokenSequencePattern pattern)
pattern
- The TokensRegex pattern to match against.public boolean matches(java.lang.String pattern)
pattern
- The TokensRegex pattern to match against.public <T> java.util.List<T> find(TokenSequencePattern pattern, java.util.function.Function<TokenSequenceMatcher,T> fn)
pattern
- The TokensRegex pattern to match against.fn
- The action to do on each match.public <T> java.util.List<T> find(java.lang.String pattern, java.util.function.Function<TokenSequenceMatcher,T> fn)
public <T> java.util.List<T> semgrex(SemgrexPattern pattern, java.util.function.Function<SemgrexMatcher,T> fn)
pattern
- The Semgrex pattern to match against.fn
- The action to do on each match.public <T> java.util.List<T> semgrex(java.lang.String pattern, java.util.function.Function<SemgrexMatcher,T> fn)
pattern
- The Semgrex pattern to match against.fn
- The action to do on each match.