@Beta public class TextObject extends Object implements CharSequence, Appendable
LanguageProfiles,
as well as to pass it in to LanguageDetector.detect(java.lang.CharSequence).
To get one, use a TextObjectFactory (through a TextObjectFactoryBuilder).
Example use:
//create the factory once:
TextObjectFactory textObjectFactory = new TextObjectFactoryBuilder()
.withTextFilter(UrlTextFilter.getInstance())
.build();
//then create as many text objects as you like:
TextObject inputText = textObjectFactory.create().append("deutsche Text").append(" ").append("blah blah");
All append() methods go through the textFilter.
Equals/hashCode are not implemented as of now on purpose. You may want to call toString() and compare that.| Constructor and Description |
|---|
TextObject(TextFilter textFilter,
int maxTextLength) |
| Modifier and Type | Method and Description |
|---|---|
Appendable |
append(char c) |
TextObject |
append(CharSequence text)
Append the target text for language detection.
|
Appendable |
append(CharSequence csq,
int start,
int end) |
TextObject |
append(Reader reader)
Append the target text for language detection.
|
char |
charAt(int index) |
int |
length() |
CharSequence |
subSequence(int start,
int end) |
String |
toString() |
public TextObject(@NotNull
TextFilter textFilter,
int maxTextLength)
maxTextLength - 0 for no limitpublic TextObject append(Reader reader) throws IOException
reader - the input reader (BufferedReader as usual)IOException - Can't read the reader.public TextObject append(CharSequence text)
append in interface Appendabletext - the target text to appendpublic Appendable append(CharSequence csq, int start, int end) throws IOException
append in interface AppendableIOExceptionpublic Appendable append(char c) throws IOException
append in interface AppendableIOExceptionpublic int length()
length in interface CharSequencepublic char charAt(int index)
charAt in interface CharSequencepublic CharSequence subSequence(int start, int end)
subSequence in interface CharSequence@NotNull public String toString()
toString in interface CharSequencetoString in class ObjectCopyright © 2015. All rights reserved.