// Path: edits-core/src/main/java/org/edits/etaf/Annotation.java
// @Data
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlType(name = "Annotation", propOrder = {})
// @XmlRootElement(name = "annotation")
// public class Annotation {
// 
// 	@XmlAttribute
// 	private String cpostag;
// 	@XmlAttribute
// 	private String deprel;
// 	@XmlAttribute
// 	private int end;
// 	@XmlAttribute
// 	private String feats;
// 	@XmlAttribute
// 	private String form;
// 	@XmlAttribute
// 	private String head;
// 	@XmlAttribute
// 	private String id;
// 	@XmlAttribute
// 	private String lemma;
// 	@XmlAttribute
// 	private String postag;
// 	@XmlAttribute
// 	private int start;
// 
// }


import java.util.ArrayList;
import java.util.List;
import lombok.extern.log4j.Log4j;
import opennlp.tools.parser.AbstractBottomUpParser;
import opennlp.tools.parser.Parse;
import opennlp.tools.parser.Parser;
import opennlp.tools.parser.ParserFactory;
import opennlp.tools.parser.ParserModel;
import opennlp.tools.postag.POSModel;
import opennlp.tools.postag.POSTagger;
import opennlp.tools.postag.POSTaggerME;
import opennlp.tools.tokenize.Tokenizer;
import opennlp.tools.tokenize.TokenizerME;
import opennlp.tools.tokenize.TokenizerModel;
import opennlp.tools.util.Sequence;
import opennlp.tools.util.Span;
import org.apache.lucene.queryparser.classic.ParseException;
import org.edits.etaf.Annotation;
import org.tartarus.snowball.ext.EnglishStemmer;
package org.edits.nlp;




@Log4j
public class OpenNLP implements org.edits.EditsTextAnnotator {
	private static OpenNLP instance;

	public static OpenNLP getInstance() {
		if (instance == null) {
			try {
				instance = new OpenNLP();
			} catch (Exception e) {
				log.debug(e);
				throw new RuntimeException("Could not load OpenNLP models");
			}
		}
		return instance;
	}

	private final Parser parser;
	private final EnglishStemmer stemmer;

	private final POSTagger tagger;

	private final Tokenizer tokenizer;

	public OpenNLP() throws Exception {
		tagger = new POSTaggerME(new POSModel(this.getClass().getClassLoader()
				.getResourceAsStream("models/en-pos-maxent.bin")));
		parser = ParserFactory.create(new ParserModel(this.getClass().getClassLoader()
				.getResourceAsStream("models/en-parser-chunking.bin")));
		tokenizer = new TokenizerME(new TokenizerModel(this.getClass().getClassLoader()
				.getResourceAsStream("models/en-token.bin")));
		stemmer = new EnglishStemmer();
		log.info("OpenNLP models loaded");
	}

	@Override
// Path: edits-core/src/main/java/org/edits/etaf/Annotation.java
// @Data
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlType(name = "Annotation", propOrder = {})
// @XmlRootElement(name = "annotation")
// public class Annotation {
// 
// 	@XmlAttribute
// 	private String cpostag;
// 	@XmlAttribute
// 	private String deprel;
// 	@XmlAttribute
// 	private int end;
// 	@XmlAttribute
// 	private String feats;
// 	@XmlAttribute
// 	private String form;
// 	@XmlAttribute
// 	private String head;
// 	@XmlAttribute
// 	private String id;
// 	@XmlAttribute
// 	private String lemma;
// 	@XmlAttribute
// 	private String postag;
// 	@XmlAttribute
// 	private int start;
// 
// }


// Path: edits-nlp/src/main/java/org/edits/nlp/OpenNLP.java
import java.util.ArrayList;
import java.util.List;
import lombok.extern.log4j.Log4j;
import opennlp.tools.parser.AbstractBottomUpParser;
import opennlp.tools.parser.Parse;
import opennlp.tools.parser.Parser;
import opennlp.tools.parser.ParserFactory;
import opennlp.tools.parser.ParserModel;
import opennlp.tools.postag.POSModel;
import opennlp.tools.postag.POSTagger;
import opennlp.tools.postag.POSTaggerME;
import opennlp.tools.tokenize.Tokenizer;
import opennlp.tools.tokenize.TokenizerME;
import opennlp.tools.tokenize.TokenizerModel;
import opennlp.tools.util.Sequence;
import opennlp.tools.util.Span;
import org.apache.lucene.queryparser.classic.ParseException;
import org.edits.etaf.Annotation;
import org.tartarus.snowball.ext.EnglishStemmer;

package org.edits.nlp;




@Log4j
public class OpenNLP implements org.edits.EditsTextAnnotator {
	private static OpenNLP instance;

	public static OpenNLP getInstance() {
		if (instance == null) {
			try {
				instance = new OpenNLP();
			} catch (Exception e) {
				log.debug(e);
				throw new RuntimeException("Could not load OpenNLP models");
			}
		}
		return instance;
	}

	private final Parser parser;
	private final EnglishStemmer stemmer;

	private final POSTagger tagger;

	private final Tokenizer tokenizer;

	public OpenNLP() throws Exception {
		tagger = new POSTaggerME(new POSModel(this.getClass().getClassLoader()
				.getResourceAsStream("models/en-pos-maxent.bin")));
		parser = ParserFactory.create(new ParserModel(this.getClass().getClassLoader()
				.getResourceAsStream("models/en-parser-chunking.bin")));
		tokenizer = new TokenizerME(new TokenizerModel(this.getClass().getClassLoader()
				.getResourceAsStream("models/en-token.bin")));
		stemmer = new EnglishStemmer();
		log.info("OpenNLP models loaded");
	}

	@Override
	public List<Annotation> annotate(String text) throws ParseException {