From 64da2e593ede93b33ddab9d3681353571595294a Mon Sep 17 00:00:00 2001 From: shellrean Date: Mon, 10 Jun 2024 23:41:19 +0700 Subject: [PATCH] fix missformat java declaration array --- opennlp-docs/src/docbkx/chunker.xml | 10 +++++----- opennlp-docs/src/docbkx/introduction.xml | 2 +- opennlp-docs/src/docbkx/namefinder.xml | 4 ++-- opennlp-docs/src/docbkx/parser.xml | 2 +- opennlp-docs/src/docbkx/postagger.xml | 8 ++++---- opennlp-docs/src/docbkx/sentdetect.xml | 4 ++-- opennlp-docs/src/docbkx/tokenizer.xml | 8 ++++---- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/opennlp-docs/src/docbkx/chunker.xml b/opennlp-docs/src/docbkx/chunker.xml index 5c65deace..444819926 100644 --- a/opennlp-docs/src/docbkx/chunker.xml +++ b/opennlp-docs/src/docbkx/chunker.xml @@ -98,18 +98,18 @@ ChunkerME chunker = new ChunkerME(model);]]> The following code shows how to determine the most likely chunk tag sequence for a sentence. +String[] tag = chunker.chunk(sent, pos);]]> The tags array contains one chunk tag for each token in the input array. The corresponding tag can be found at the same index as the token has in the input array. @@ -117,7 +117,7 @@ String tag[] = chunker.chunk(sent, pos);]]> a ChunkerME with the following method call: +double[] probs = chunker.probs();]]> The call to probs is stateful and will always return the probabilities of the last tagged sentence. The probs method should only be called when the tag method @@ -130,7 +130,7 @@ double probs[] = chunker.probs();]]> It can be called in a similar way as chunk. +Sequence[] topSequences = chunk.topKSequences(sent, pos);]]> Each Sequence object contains one sequence. The sequence can be retrieved via Sequence.getOutcomes() which returns a tags array diff --git a/opennlp-docs/src/docbkx/introduction.xml b/opennlp-docs/src/docbkx/introduction.xml index 5187039a4..1aee630a7 100644 --- a/opennlp-docs/src/docbkx/introduction.xml +++ b/opennlp-docs/src/docbkx/introduction.xml @@ -81,7 +81,7 @@ ToolName toolName = new ToolName(model);]]> and the input is a String or an array of String. +String[] output = toolName.executeTask("This is a sample text.");]]> diff --git a/opennlp-docs/src/docbkx/namefinder.xml b/opennlp-docs/src/docbkx/namefinder.xml index 8566467ed..cdf77d3f2 100644 --- a/opennlp-docs/src/docbkx/namefinder.xml +++ b/opennlp-docs/src/docbkx/namefinder.xml @@ -130,7 +130,7 @@ for (String document[][] : documents) { the following snippet shows a call to find +Span[] nameSpans = nameFinder.find(sentence);]]> The nameSpans arrays contains now exactly one Span which marks the name Pierre Vinken. The elements between the start and end offsets are the name tokens. In this case the start diff --git a/opennlp-docs/src/docbkx/parser.xml b/opennlp-docs/src/docbkx/parser.xml index f5dd8c492..2dc1ecd62 100644 --- a/opennlp-docs/src/docbkx/parser.xml +++ b/opennlp-docs/src/docbkx/parser.xml @@ -111,7 +111,7 @@ Parser parser = ParserFactory.create(model);]]> +Parse[] topParses = ParserTool.parseLine(sentence, parser, 1);]]> The topParses array only contains one parse because the number of parses is set to 1. diff --git a/opennlp-docs/src/docbkx/postagger.xml b/opennlp-docs/src/docbkx/postagger.xml index 69eacc60f..5f045e4f8 100644 --- a/opennlp-docs/src/docbkx/postagger.xml +++ b/opennlp-docs/src/docbkx/postagger.xml @@ -86,9 +86,9 @@ POSTaggerME tagger = new POSTaggerME(model);]]> The following code shows how to determine the most likely pos tag sequence for a sentence. +String[] tags = tagger.tag(sent);]]> The tags array contains one part-of-speech tag for each token in the input array. The corresponding tag can be found at the same index as the token has in the input array. @@ -96,7 +96,7 @@ String tags[] = tagger.tag(sent);]]> a POSTaggerME with the following method call: +double[] probs = tagger.probs();]]> The call to probs is stateful and will always return the probabilities of the last tagged sentence. The probs method should only be called when the tag method @@ -109,7 +109,7 @@ double probs[] = tagger.probs();]]> It can be called in a similar way as tag. +Sequence[] topSequences = tagger.topKSequences(sent);]]> Each Sequence object contains one sequence. The sequence can be retrieved via Sequence.getOutcomes() which returns a tags array diff --git a/opennlp-docs/src/docbkx/sentdetect.xml b/opennlp-docs/src/docbkx/sentdetect.xml index ee7868ebb..4e3a1db6d 100644 --- a/opennlp-docs/src/docbkx/sentdetect.xml +++ b/opennlp-docs/src/docbkx/sentdetect.xml @@ -94,14 +94,14 @@ SentenceDetectorME sentenceDetector = new SentenceDetectorME(model);]]> The Sentence Detector can output an array of Strings, where each String is one sentence. +String[] sentences = sentenceDetector.sentDetect(" First sentence. Second sentence. ");]]> The result array now contains two entries. The first String is "First sentence." and the second String is "Second sentence." The whitespace before, between and after the input String is removed. The API also offers a method which simply returns the span of the sentence in the input string. +Span[] sentences = sentenceDetector.sentPosDetect(" First sentence. Second sentence. ");]]> The result array again contains two entries. The first span beings at index 2 and ends at 17. The second span begins at 18 and ends at 34. The utility method Span.getCoveredText can be used to create a substring which only covers the chars in the span. diff --git a/opennlp-docs/src/docbkx/tokenizer.xml b/opennlp-docs/src/docbkx/tokenizer.xml index 32d4f2412..3627d8253 100644 --- a/opennlp-docs/src/docbkx/tokenizer.xml +++ b/opennlp-docs/src/docbkx/tokenizer.xml @@ -171,7 +171,7 @@ Tokenizer tokenizer = new TokenizerME(model);]]> Strings, where each String is one token. +String[] tokens = tokenizer.tokenize("An input sample sentence.");]]> The output will be an array with these tokens. @@ -183,7 +183,7 @@ String tokens[] = tokenizer.tokenize("An input sample sentence.");]]> String. +Span[] tokenSpans = tokenizer.tokenizePos("An input sample sentence.");]]> The tokenSpans array now contain 5 elements. To get the text for one span call Span.getCoveredText which takes a span and the input text. @@ -195,8 +195,8 @@ Span tokenSpans[] = tokenizer.tokenizePos("An input sample sentence.");]]> +String[] tokens = tokenizer.tokenize(...); +double[] tokenProbs = tokenizer.getTokenProbabilities();]]> The tokenProbs array now contains one double value per token, the value is between 0 and 1, where 1 is the highest possible probability