Java Reference
In-Depth Information
Converting to lowercase
Converting text to lowercase is a simple process that can improve search results. We can
either use Java methods such as the
String
class'
toLowerCase
method, or use the
capability found in some NLP APIs such as LingPipe's
LowerCaseTokenizerFact-
ory
class. The
toLowerCase
method is demonstrated here:
String text = "A Sample string with acronyms, IBM, and UPPER
" + "and lowercase letters.";
String result = text.toLowerCase();
System.out.println(result);
The output will be as follows:
a sample string with acronyms, ibm, and upper and lowercase
letters.
LingPipe's
LowerCaseTokenizerFactory
approach is illustrated in the section
Normalizing using a pipeline
, later in this chapter.