You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jo...@apache.org on 2011/05/31 12:40:30 UTC
svn commit: r1129604 -
/incubator/opennlp/trunk/opennlp-docs/src/docbkx/sentdetect.xml
Author: joern
Date: Tue May 31 10:40:30 2011
New Revision: 1129604
URL: http://svn.apache.org/viewvc?rev=1129604&view=rev
Log:
OPENNLP-194 Fixed too long lines
Modified:
incubator/opennlp/trunk/opennlp-docs/src/docbkx/sentdetect.xml
Modified: incubator/opennlp/trunk/opennlp-docs/src/docbkx/sentdetect.xml
URL: http://svn.apache.org/viewvc/incubator/opennlp/trunk/opennlp-docs/src/docbkx/sentdetect.xml?rev=1129604&r1=1129603&r2=1129604&view=diff
==============================================================================
--- incubator/opennlp/trunk/opennlp-docs/src/docbkx/sentdetect.xml (original)
+++ incubator/opennlp/trunk/opennlp-docs/src/docbkx/sentdetect.xml Tue May 31 10:40:30 2011
@@ -37,16 +37,18 @@ under the License.
The sample text below should be segmented into its sentences.
<programlisting>
<![CDATA[
-Pierre Vinken, 61 years old, will join the board as a nonexecutive director Nov. 29. Mr. Vinken is chairman of Elsevier N.V.,
-the Dutch publishing group. Rudolph Agnew, 55 years old and former chairman of Consolidated Gold Fields PLC,
-was named a director of this British industrial conglomerate.]]>
+Pierre Vinken, 61 years old, will join the board as a nonexecutive director Nov. 29. Mr. Vinken is
+chairman of Elsevier N.V., the Dutch publishing group. Rudolph Agnew, 55 years
+old and former chairman of Consolidated Gold Fields PLC, was named a director of this
+British industrial conglomerate.]]>
</programlisting>
After detecting the sentence boundaries each sentence is written in its own line.
<programlisting>
<![CDATA[
Pierre Vinken, 61 years old, will join the board as a nonexecutive director Nov. 29.
Mr. Vinken is chairman of Elsevier N.V., the Dutch publishing group.
-Rudolph Agnew, 55 years old and former chairman of Consolidated Gold Fields PLC, was named a director of this British industrial conglomerate.]]>
+Rudolph Agnew, 55 years old and former chairman of Consolidated Gold Fields PLC,
+ was named a director of this British industrial conglomerate.]]>
</programlisting>
Usually Sentence Detection is done before the text is tokenized and thats the way the pre-trained models on the web site are trained,
but it is also possible to perform tokenization first and let the Sentence Detector process the already tokenized text.
@@ -132,7 +134,8 @@ Span sentences[] = sentenceDetector.sent
<programlisting>
<![CDATA[
$bin/opennlp SentenceDetectorTrainer
-Usage: opennlp SentenceDetectorTrainer -lang language -encoding charset [-iterations num] [-cutoff num] -data trainingData -model model
+Usage: opennlp SentenceDetectorTrainer -lang language -encoding charset [-iterations num] \
+[-cutoff num] -data trainingData -model model
-lang language specifies the language which is being processed.
-encoding charset specifies the encoding which should be used for reading and writing text.
-iterations num specified the number of training iterations
@@ -196,7 +199,8 @@ Path: en-sent.bin
The following sample code illustrates these steps:
<programlisting language="java">
<![CDATA[
-ObjectStream<String> lineStream = new PlainTextByLineStream(new FileInputStream("en-sent.train"), "UTF-8");
+ObjectStream<String> lineStream = new PlainTextByLineStream(new FileInputStream("en-sent.train"),
+ "UTF-8");
ObjectStream<SentenceSample> sampleStream = new SentenceSampleStream(lineStream);
SentenceModel model = SentenceDetectorME.train("en",sampleStream, true, null, 5, 100);