// Path: geo-locator/src/edu/cmu/geolocator/io/GetReader.java
// public class GetReader {
// 
//   public static BufferedReader getUTF8FileReader(String filename) throws FileNotFoundException,
//           UnsupportedEncodingException {
//     File file = new File(filename);
//     BufferedReader bin = new BufferedReader(new InputStreamReader(new FileInputStream(file),
//             "utf-8"));
//     return bin;
//   }
// 
//   public static IndexSearcher getIndexSearcherFromWriter(String filename) throws IOException {
//     IndexWriter iw = GetWriter.getIndexWriter(filename, 1024);
//     IndexReader ir = IndexReader.open(iw, false);
//     IndexSearcher searcher = new IndexSearcher(ir);
//     return searcher;
//   }
// 
//   public static IndexSearcher getIndexSearcher(String filename, String diskOrMem) throws Exception {
//     IndexReader reader;
//     Directory d ;
//     if (diskOrMem.equals("disk"))
//       d = FSDirectory.open(new File(filename));
//     else if (diskOrMem.equals("mmap"))
//       d=  MmapDirectory(new File(filename));
//     else
//       throw new Exception("parameter for directory type not defined.");
//     
//     if(OSUtil.isWindows())
//      reader = IndexReader.open(FSDirectory.open(new File(filename)));
//     else
//       reader = IndexReader.open(NIOFSDirectory.open(new File(filename))); 
//     IndexSearcher searcher = new IndexSearcher(reader);
//     return searcher;
//   }
// 
//   private static Directory MmapDirectory(File file) {
//     // TODO Auto-generated method stub
//     return null;
//   }
// 
//   public static BufferedReader getCommandLineReader() throws UnsupportedEncodingException {
//     BufferedReader br = new BufferedReader(new InputStreamReader(System.in, "utf-8"));
//     return br;
//   }
// 
// }


import edu.cmu.minorthird.classify.Example;
import edu.cmu.minorthird.classify.Feature;
import edu.cmu.minorthird.classify.MutableInstance;
import edu.cmu.minorthird.classify.sequential.CMM;
import edu.cmu.minorthird.classify.sequential.CRFLearner;
import edu.cmu.minorthird.classify.sequential.CollinsPerceptronLearner;
import edu.cmu.minorthird.classify.sequential.SequenceDataset;
import edu.cmu.minorthird.util.IOUtil;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import edu.cmu.geolocator.io.GetReader;
import edu.cmu.minorthird.classify.ClassLabel;
/**
 * 
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you 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.
 * 
 * @author Wei Zhang,  Language Technology Institute, School of Computer Science, Carnegie-Mellon University.
 * email: wei.zhang@cs.cmu.edu
 * 
 */
package edu.cmu.geolocator.nlp.ner.MinorThirdCRF;



public class Learner {

	public static void main(String argv[]) throws IOException {
		String lang = "en";
		String learner = "crf";
		String featuretype
		// = "ct-only";
		 = "-3tok*.3pres.2cap.3caps.1pos.2pos.1gaz.1gazs.1cty.1ctys.-3-1prep";
		int iter = 150;	
// Path: geo-locator/src/edu/cmu/geolocator/io/GetReader.java
// public class GetReader {
// 
//   public static BufferedReader getUTF8FileReader(String filename) throws FileNotFoundException,
//           UnsupportedEncodingException {
//     File file = new File(filename);
//     BufferedReader bin = new BufferedReader(new InputStreamReader(new FileInputStream(file),
//             "utf-8"));
//     return bin;
//   }
// 
//   public static IndexSearcher getIndexSearcherFromWriter(String filename) throws IOException {
//     IndexWriter iw = GetWriter.getIndexWriter(filename, 1024);
//     IndexReader ir = IndexReader.open(iw, false);
//     IndexSearcher searcher = new IndexSearcher(ir);
//     return searcher;
//   }
// 
//   public static IndexSearcher getIndexSearcher(String filename, String diskOrMem) throws Exception {
//     IndexReader reader;
//     Directory d ;
//     if (diskOrMem.equals("disk"))
//       d = FSDirectory.open(new File(filename));
//     else if (diskOrMem.equals("mmap"))
//       d=  MmapDirectory(new File(filename));
//     else
//       throw new Exception("parameter for directory type not defined.");
//     
//     if(OSUtil.isWindows())
//      reader = IndexReader.open(FSDirectory.open(new File(filename)));
//     else
//       reader = IndexReader.open(NIOFSDirectory.open(new File(filename))); 
//     IndexSearcher searcher = new IndexSearcher(reader);
//     return searcher;
//   }
// 
//   private static Directory MmapDirectory(File file) {
//     // TODO Auto-generated method stub
//     return null;
//   }
// 
//   public static BufferedReader getCommandLineReader() throws UnsupportedEncodingException {
//     BufferedReader br = new BufferedReader(new InputStreamReader(System.in, "utf-8"));
//     return br;
//   }
// 
// }


// Path: geo-locator/src/edu/cmu/geolocator/nlp/ner/MinorThirdCRF/Learner.java
import edu.cmu.minorthird.classify.Example;
import edu.cmu.minorthird.classify.Feature;
import edu.cmu.minorthird.classify.MutableInstance;
import edu.cmu.minorthird.classify.sequential.CMM;
import edu.cmu.minorthird.classify.sequential.CRFLearner;
import edu.cmu.minorthird.classify.sequential.CollinsPerceptronLearner;
import edu.cmu.minorthird.classify.sequential.SequenceDataset;
import edu.cmu.minorthird.util.IOUtil;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import edu.cmu.geolocator.io.GetReader;
import edu.cmu.minorthird.classify.ClassLabel;

/**
 * 
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you 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.
 * 
 * @author Wei Zhang,  Language Technology Institute, School of Computer Science, Carnegie-Mellon University.
 * email: wei.zhang@cs.cmu.edu
 * 
 */
package edu.cmu.geolocator.nlp.ner.MinorThirdCRF;



public class Learner {

	public static void main(String argv[]) throws IOException {
		String lang = "en";
		String learner = "crf";
		String featuretype
		// = "ct-only";
		 = "-3tok*.3pres.2cap.3caps.1pos.2pos.1gaz.1gazs.1cty.1ctys.-3-1prep";
		int iter = 150;	
		BufferedReader br = GetReader.getUTF8FileReader("trainingdata/" + lang + "NER/train/" + featuretype