CuratorConnectionExample2.java

#
package edu.illinois.cs.cogcomp.edison.examples;

import java.util.Arrays;
import java.util.List;

import org.apache.thrift.TException;

import edu.illinois.cs.cogcomp.edison.data.curator.CuratorClient;
import edu.illinois.cs.cogcomp.edison.sentences.TextAnnotation;
import edu.illinois.cs.cogcomp.edison.sentences.ViewNames;
import edu.illinois.cs.cogcomp.thrift.base.AnnotationFailedException;
import edu.illinois.cs.cogcomp.thrift.base.ServiceUnavailableException;

public class CuratorConnectionExample2 {

    public static void main(String[] args) throws ServiceUnavailableException,
	    AnnotationFailedException, TException {

	List<String> tokenizedSentences = Arrays
		.asList(" The Sidley-Ashurst venture will also be"
			+ " staffed by another Sidley partner "
			+ "specializing in corporate law , a partner"
			+ " from Ashurst concentrating on acquisitions"
			+ " and a Japanese attorney .");

	String curatorHost = "smeagol.cs.uiuc.edu";
	int curatorPort = 9010;
	
	boolean tokenizedInput = true;
	
	CuratorClient client = new CuratorClient(curatorHost, curatorPort,
		tokenizedInput);

	TextAnnotation ta = new TextAnnotation("corpus", "textId",
		tokenizedSentences);

	System.out.println(ta);

	boolean forceUpdate = false;
#

Add the named entity view.

	client.addNamedEntityView(ta, forceUpdate);
#

This should print out the following output:

TextAnnotation: The Sidley-Ashurst venture will also be staffed by another Sidley partner specializing in corporate law , a partner from Ashurst concentrating on acquisitions and a Japanese attorney .

The [ORG Sidley-Ashurst ] venture will also be staffed by another Sidley partner specializing in corporate law , a partner from Ashurst concentrating on acquisitions and a [MISC Japanese ] attorney .

	System.out.println(ta.getView(ViewNames.NER));
    }
}