<commit_before>/**
 * DOCKS is a framework for post-processing results of Cloud-based speech 
 * recognition systems.
 * Copyright (C) 2014 <NAME>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Contact:
 * <EMAIL>
 */
package info.knowledgeTechnology.docks.PostProcessor;
import info.knowledgeTechnology.docks.Data.Result;
import info.knowledgeTechnology.docks.Recognizer.StandardRecognizer;

/**
 * word list postprocessor using a list of words to postprocess a result word by word
 * @author 7twiefel
 *
 */
public class WordlistPostProcessor  implements StandardRecognizer{


	private SentencelistPostProcessor lr;
	private int referenceRecognizer;
	private String name = "LexiconLookupRecognizer";
	
	/**
	 * creates a new wordlist postprocessor
	 * @param wordFile path to list of words
	 * @param referenceRecognizer recognizer the result is postprocessed from
	 * @param name of this recognizer
	 */
	private WordlistPostProcessor(String wordFile,int referenceRecognizer, String name,String key) {
		this(wordFile,key);
		this.referenceRecognizer= referenceRecognizer;
	 	this.name=name;
	}
	/**
	 * create a new wordlist postprocessor
	 * @param wordFile path to word list
	 */
	private WordlistPostProcessor(String wordFile,String key) {
		super();
		//use a Sentencelist postprocessor internally
		this.lr = new SentencelistPostProcessor(wordFile,1,key);
		referenceRecognizer= -1;
	}
	
	/**
	 * create a new wordlist postprocessor
	 * @param wordFile path to word list
	 */
	public WordlistPostProcessor(String configname,String wordFile,int numberOfResults) {
		super();
		//use a Sentencelist postprocessor internally
		this.lr = new SentencelistPostProcessor(configname,wordFile,numberOfResults);
		referenceRecognizer= -1;
	}
	
	/**
	 * postprocess a result from another ASR
	 * @param r the result
	 */<commit_msg>fixed visibility of wordlist constructor<commit_after>/**
 * DOCKS is a framework for post-processing results of Cloud-based speech 
 * recognition systems.
 * Copyright (C) 2014 <NAME>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Contact:
 * <EMAIL>
 */
package info.knowledgeTechnology.docks.PostProcessor;
import info.knowledgeTechnology.docks.Data.Result;
import info.knowledgeTechnology.docks.Recognizer.StandardRecognizer;

/**
 * word list postprocessor using a list of words to postprocess a result word by word
 * @author 7twiefel
 *
 */
public class WordlistPostProcessor  implements StandardRecognizer{


	private SentencelistPostProcessor lr;
	private int referenceRecognizer;
	private String name = "LexiconLookupRecognizer";
	
	/**
	 * creates a new wordlist postprocessor
	 * @param wordFile path to list of words
	 * @param referenceRecognizer recognizer the result is postprocessed from
	 * @param name of this recognizer
	 */
	public WordlistPostProcessor(String wordFile,int referenceRecognizer, String name,String key) {
		this(wordFile,key);
		this.referenceRecognizer= referenceRecognizer;
	 	this.name=name;
	}
	/**
	 * create a new wordlist postprocessor
	 * @param wordFile path to word list
	 */
	public WordlistPostProcessor(String wordFile,String key) {
		super();
		//use a Sentencelist postprocessor internally
		this.lr = new SentencelistPostProcessor(wordFile,1,key);
		referenceRecognizer= -1;
	}
	
	/**
	 * create a new wordlist postprocessor
	 * @param wordFile path to word list
	 */
	public WordlistPostProcessor(String configname,String wordFile,int numberOfResults) {
		super();
		//use a Sentencelist postprocessor internally
		this.lr = new SentencelistPostProcessor(configname,wordFile,numberOfResults);
		referenceRecognizer= -1;
	}
	
	/**
	 * postprocess a result from another ASR
	 * @param r the result
	 */
{'fraction_non_alphanumeric': 0.07432841850131286, 'fraction_numerical': 0.003635629165825086, 'mean_word_length': 4.330462863293865, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7592296', 'n_tokens_mistral': 1462, 'n_tokens_neox': 1309, 'n_words': 520}