eus.ixa.ixa.pipe.nerc.dict.Dictionaries Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ixa-pipe-nerc Show documentation
Show all versions of ixa-pipe-nerc Show documentation
ixa pipes sequence labeler (ixa2.si.ehu.es/ixa-pipes).
/*
* Copyright 2014 Rodrigo Agerri
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 eus.ixa.ixa.pipe.nerc.dict;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import com.google.common.base.Charsets;
import com.google.common.io.Files;
import eus.ixa.ixa.pipe.nerc.StringUtils;
/**
*
* Class to load a directory containing dictionaries into a list of
* Dictionaries. The files need to have the following structure: Barack
* Obama\tperson\n
*
* Every file located in the directory passed as a parameter will be loaded.
*
* @author ragerri
* @version 2014/06/25
*
*/
public class Dictionaries {
private static final Pattern tabPattern = Pattern.compile("\t");
public static boolean DEBUG = false;
/**
* The list of dictionary names.
*/
private static List dictNames;
/**
* The list of dictionaries as HashMap.
*/
private static List