Class TextObject

  • All Implemented Interfaces:
    Appendable, CharSequence

    @Beta
    public class TextObject
    extends Object
    implements CharSequence, Appendable
    A convenient text object implementing CharSequence and Appendable. This is an ideal object to use for learning text to create 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.
    Author:
    Fabian Kessler