org.backsource.utils.text
Class SentenceParser

java.lang.Object
  extended byorg.backsource.utils.text.SentenceParser

public class SentenceParser
extends java.lang.Object

Parse text into sentences.


Field Summary
static java.lang.String DEFAULT_PUNCTATION_CHARS
          The default punctation characters.
protected  java.lang.String punctationChars
           
protected  boolean requireSpaceAfterPunctation
          For a punctation to be recognized, a space is required to be the next character after the punctation
protected  boolean trimSpace
          Trim space from sentences
 
Constructor Summary
SentenceParser()
          Construct a new parser using the default punctation chars.
SentenceParser(boolean trimSpace, boolean requireSpaceAfterPunctation)
          Construct a new parser using default punctation chars.
SentenceParser(java.lang.String punctationChars, boolean trimSpace, boolean requireSpaceAfterPunctation)
          Construct a new parser using custom punctation chars.
 
Method Summary
static void main(java.lang.String[] argz)
          Test/demonstration.
 java.util.Vector parse(java.lang.String data)
          Parse a string into sentences
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PUNCTATION_CHARS

public static final java.lang.String DEFAULT_PUNCTATION_CHARS
The default punctation characters.

See Also:
Constant Field Values

punctationChars

protected java.lang.String punctationChars

trimSpace

protected boolean trimSpace
Trim space from sentences


requireSpaceAfterPunctation

protected boolean requireSpaceAfterPunctation
For a punctation to be recognized, a space is required to be the next character after the punctation

Constructor Detail

SentenceParser

public SentenceParser()
Construct a new parser using the default punctation chars. The parser will be configured to remove white space at the beginning and end of sentences, and require a space to be present after any punctation.


SentenceParser

public SentenceParser(java.lang.String punctationChars,
                      boolean trimSpace,
                      boolean requireSpaceAfterPunctation)
Construct a new parser using custom punctation chars.

Parameters:
trimSpace - remove space from start and end of sentences
requireSpaceAfterPunctation - only recognize punctations followed by a space

SentenceParser

public SentenceParser(boolean trimSpace,
                      boolean requireSpaceAfterPunctation)
Construct a new parser using default punctation chars.

Parameters:
trimSpace - remove space from start and end of sentences
requireSpaceAfterPunctation - only recognize punctations followed by a space
Method Detail

parse

public java.util.Vector parse(java.lang.String data)
Parse a string into sentences


main

public static void main(java.lang.String[] argz)
Test/demonstration. Pars the first argument and print the result to System.out



Copyright © 2000-2004 Backsource. All Rights Reserved.