Java Reference
In-Depth Information
Pipelines
A pipeline is nothing more than a sequence of operations where the output of one opera-
tion is used as the input to another operation. We have seen it used in several examples in
previous chapters but they have been relatively short. In particular, we saw how the Stan-
ford StanfordCoreNLP class, with its use of annotators objects, supports the concept of
pipelines nicely. We will discuss this approach in the next section.
One of the advantages of a pipeline, if structured properly, is that it allows the easy addition
and removal of processing elements. For example, if one step of the pipeline converts token
to lowercase, then it can be easy to simply remove this step with the remaining elements of
the pipeline left untouched.
However, some pipelines are not always this flexible. One step may require a previous step
in order to work properly. In a pipeline, such as the one supported by the Stan-
fordCoreNLP class, the following set of annotators is needed to support POS processing:
props.put("annotators", "tokenize, ssplit, pos");
If we leave out the ssplit annotator, the following exception is generated:
java.lang.IllegalArgumentException: annotator "pos" requires
annotator "ssplit"
Although the Stanford pipeline does not require a lot of effort to set up, other pipelines
may. We will demonstrate the latter approach in the Creating a pipeline to search text sec-
tion.
Search WWH ::




Custom Search