Pepper  3.6.0
A highly extensible plattform for conversion and manipulationoflinguisticdata.
Pepper as a library

With the Pepper library, we provide a programmatic access to the Pepper framework, including the configuration of a conversion workflow, the start of a conversion and getting information about the registered Pepper modules. Since Pepper is based on a plugin structure called OSGi (see:, each Pepper module is plugged into the framework separately, whether running Pepper as CLI, or running it as a library. The Pepper framework consists of two necessary components: a jar file, which can be included in your software project via maven, and a plugin folder containing all Pepper modules. The following excerpt shows the necessary maven coordinates.


When Pepper is included in your project, you need to get all necessary plugins and modules, therefore:

  1. Download a Pepper release of your choice from
  2. Unzip the downloaded zip file
  3. Copy the contained folder plugins to a folder of your choice, let's call it PLUGINS_HOME.

Now you can start coding. Here is a template, showing how to initialize a Pepper object.

PepperStarterConfiguration pepperConf = new PepperStarterConfiguration();
pepperConf.setProperty(PepperStarterConfiguration.PROP_PLUGIN_PATH, PATH_TO_PLUGINS);
PepperConnector pepper = new PepperOSGiConnector();

Let's have some code explanations with that:

In line 1, we initialize a configuration object to configure the Pepper framework before starting it. Line 2 sets the plugin folder. Please replace the placeholder "PLUGIN_HOME" with the real location. The configuration provides some more adaptation possibilities, just have a look at the JavaDoc or the class itself.

In line 3, we initialize the proper Pepper object symbolising the Pepper framework. In the future, there may be several connectors to access the framework, e.g. to access a Pepper instance running on a remote server. But currently there is just an OSGi connector, which starts a separate OSGi environment (Pepper uses the OSGi environment Equinox, see

The last line of code passes the configuration to the Pepper object. Pepper is configured now and we are ready to use it. Before we start a conversion workflow, we show how to query the registered modules. The following snippet prints all information about a module to standard out.

for (PepperModuleDesc moduleDesc: pepper.getRegisteredModules()){

Next, we show how to create a single workflow in Pepper and how to run it. In Pepper, a workflow is called a job and is represented by the class PepperJob. A job consists of several steps. A step can handle an importer, a manipulator or an exporter. A job can contain 1 to n importers, 0 to n manipulators and 1 to n exporters. When using an importer or an exporter, we need to describe the corpus to be im- and exported. The following snippet shows the creation of a corpus description, containing the location of the corpus and a description of the format of the corpus.

CorpusDesc corpusExport= new CorpusDesc().setCorpusPath(URI.createFileURI("CORPUS_PATH"));
CorpusDesc corpusImport= new CorpusDesc().setCorpusPath(URI.createFileURI("CORPUS_PATH"));
String jobId= pepper.createJob();
PepperJob job= pepper.getJob(jobId);
job.addStepDesc(new StepDesc().setProps(new Properties()).setCorpusDesc(corpusImport));
job.addStepDesc(new StepDesc().setProps(new Properties()).setCorpusDesc(corpusExport));
//start conversion

Here we create two corpora (line 1-4 and line 10-13) and two steps (line 6-8 and 15-17), one for the import and one for the export. When creating a step, you can also pass some properties for customization. For detailed description of which properties are available corresponding to a specific module, please take a look at the documentation of the Pepper module. After creating the steps, we need to add them to the job (line 21-22). So the last thing to do is to start the job with invoking the method 'convert()' (line 24). Another way of converting a job is converting a predefined workflow file. The following snippet shows how to do this.

String jobId= pepper.createJob();
PepperJob pepperJob= pepper.getJob(jobId);

Import data

With Pepper you can just import data into a Salt model for further processing in your application. Therefore you need to define an import step and start the conversion via convertFrom() instead of convert().

job.addStepDesc(new StepDesc().setName(IMPORTER_NAME).setCorpusDesc(new CorpusDesc().setCorpusPath(URI.createFileURI(PATH_TO_CORPUS))).setModuleType(MODULE_TYPE.IMPORTER));

Afterwards, you can access the Salt model and work with it.


Attention: If your main application is not part of the OSGi environment, you can run into class loader exceptions when accessing Pepper. To avoid such exceptions, read Bridging OSGi.

Export data

With Pepper you can create a Salt model in your main application and export it to any supported format. Therefore you need to define an export step and start the conversion via convertTo() instead of convert(). Define your model via:


Afterwards, you can export it with:

job.addStepDesc(new StepDesc().setName(EXPORTER_NAME).setCorpusDesc(new CorpusDesc().setCorpusPath(URI.createFileURI(PATH_TO_CORPUS))).setModuleType(MODULE_TYPE.EXPORTER));

Attention: If your main application is not part of the OSGi environment, you can run into class loader exceptions when accessing Pepper. To avoid such exceptions, read Bridging OSGi.

Bridging OSGi

Since Pepper is running in an OSGi container, it uses a different class loader than your main application. When you now try to access Salt model elements, it can happen that you get a class loader exception. To avoid that, Pepper offers you a mechanism to bridge objects from your main application to OSGi and back. Therefore it is necessary to register all concerning packages before Pepper is initialized. The following snippet shows this mechanism:

PepperOSGiConnector pepper = new PepperOSGiConnector();
pepper.addSharedPackage("org.corpus_tools.salt", "3");
pepper.addSharedPackage("org.corpus_tools.salt.common", "3");
pepper.addSharedPackage("org.corpus_tools.salt.core", "3");
pepper.addSharedPackage("org.corpus_tools.salt.graph", "3");
pepper.addSharedPackage("org.corpus_tools.salt.util", "3");