reckart / tt4j

TreeTagger for Java
http://reckart.github.io/tt4j/
Apache License 2.0
16 stars 7 forks source link

// Copyright (c) 2009-2014 Richard Eckart de Castilho. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License.

= TreeTagger for Java

image:https://travis-ci.org/reckart/tt4j.svg["Build Status", link="https://travis-ci.org/reckart/tt4j"] image:https://maven-badges.herokuapp.com/maven-central/org.annolab.tt4j/org.annolab.tt4j/badge.svg["Maven Central", link="https://maven-badges.herokuapp.com/maven-central/org.annolab.tt4j/org.annolab.tt4j"]

TreeTagger for Java is a Java wrapper around the popular link:http://www.cis.uni-muenchen.de/~schmid/tools/TreeTagger/[TreeTagger] package by Helmut Schmid. It was written with a focus on platform-independence and easy integration into applications. It is written in Java 5 and has been tested on OS X, Ubuntu Linux, and Windows.

For more information, see link:http://reckart.github.io/tt4j/[TreeTagger for Java] project page.

//// === Code example

[source,java]

package org.annolab.tt4j;

import static java.util.Arrays.asList;

public class Example { public static void main(String[] args) throws Exception { // Point TT4J to the TreeTagger installation directory. The executable is expected // in the "bin" subdirectory - in this example at "/opt/treetagger/bin/tree-tagger" System.setProperty("treetagger.home", "/opt/treetagger"); TreeTaggerWrapper tt = new TreeTaggerWrapper(); try { tt.setModel("/opt/treetagger/models/english.par:iso8859-1"); tt.setHandler(new TokenHandler() { public void token(String token, String pos, String lemma) { System.out.println(token + "\t" + pos + "\t" + lemma); } }); tt.process(asList(new String[] { "This", "is", "a", "test", "." })); } finally { tt.destroy(); } } }

The latest version of TT4J is now available via link:http://repo1.maven.org/maven2/org/annolab/tt4j/[Maven Central]. If you use Maven as your build tool, then you can add it as a dependency in your pom.xml file:

[source,xml]

org.annolab.tt4j org.annolab.tt4j 1.2.1

=== License

The link:http://www.cis.uni-muenchen.de/~schmid/tools/TreeTagger/[TreeTagger] package, which is wrapped by TT4J, may only be used according to the link:http://www.cis.uni-muenchen.de/~schmid/tool/TreeTagger/Tagger-Licence[TreeTagger license terms]. TreeTagger for Java is provided under the Apache License version 2.0 without any warranty. ////