All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.itc.irst.tcc.sre.Parameter Maven / Gradle / Ivy

/*
 * Copyright 2005 FBK-irst (http://www.fbk.eu)
 *
 * 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.
 */
package org.itc.irst.tcc.sre;

import java.util.*;
import java.io.*;
import org.slf4j.Logger;import org.slf4j.LoggerFactory;

//
public class Parameter
{
	/**
 	* Define a static logger variable so that it references the
	 * Logger instance named Parameter.
	 */
	static Logger logger = LoggerFactory.getLogger(Parameter.class.getName());

	/**
	 * A prototype for a global context such that only
	 * one instance class can ever exist.
	 */
	private static Parameter parameter;

	//
	public static final String DEFAULT_STEMMER = "Porter";

	//
	public static final String DEFAULT_KERNEL = "GC";

	//
	public static final int DEFAULT_CACHE_SIZE = 128;

	//
	public static final int DEFAULT_LOCAL_WINDOW_SIZE = 1;

	//
	public static final int DEFAULT_NGRAM = 3;

	//
	private int cacheSize;

	//
	private String kernel;

	//
	private int localSize;

	//
	private int ngram;

	//
	private String stemmer;

	//
	private boolean useTF;

	//
	private File paramFile;

	//
	private boolean printHelp;

	//
	private File inputFile;

	//
	private File modelFile;

	//
	private Parameter()
	{
		parameter = this;

		// default
		cacheSize = DEFAULT_CACHE_SIZE;
		kernel = DEFAULT_KERNEL;
		localSize = DEFAULT_LOCAL_WINDOW_SIZE;
		ngram = DEFAULT_NGRAM;
		stemmer = DEFAULT_STEMMER;
		useTF = false;
		printHelp = false;

	} // end constructor

	//
	public void parse(String[] args) throws IOException
	{
		inputFile = new File(args[args.length - 2]);
		modelFile = new File(args[args.length - 1]);


		// set parameters
		for (int i=0;iParameter object; only
 	* one Parameter instance can
 	* exist.
 	*
 	* @return	Parameter object
 	*/
	public static synchronized Parameter getInstance()
	{
		if (parameter == null)
		{
			parameter = new Parameter();
		}

		return parameter;
	} // end getInstance

} // end class Parameter




© 2015 - 2025 Weber Informatics LLC | Privacy Policy