Commit 3090d81b authored by JR's avatar JR

Translation.

parent 47b6b6cd
......@@ -22,30 +22,21 @@ import gate.FeatureMap;
public class PropertiesUtil {
protected Logger logger;
public PropertiesUtil() {
logger = Logger.getLogger(this.getClass().getName());
}
/**
* Envia os dados de configurao lidos do dicionrio para o Creole.
* criado um parmetro do Creole para cada parmetro de configurao.
* Create Creole parameters based on dictionary configuration lines.
* Configuration lines are those between tags |/CONFIG| and |/CONFIG|.
* Lines that start with "%%" are just comments.
*
* @param gazetteerFile
*/
public HashMap<String, String> loadConfig2CreoleParameters(BufferedReader dictionaryBuffReader) throws Exception {
// BufferedReader dictionaryBuffReader = new BomStrippingInputStreamReader((configFileURL).openStream(), encoding);
// logger.info("Linhas no metodo loadConfig2CreoleParameters: " +
// dictionaryBuffReader.lines().count());
// HashMap<String, String> listConfigFromDictionary =
// listHeaderConfigLoader(dictionaryBuffReader);
HashMap<String, String> listConfigFromDictionary = new HashMap<>();
List<String> configLines = new ArrayList();
// configLines = extractConfigHeaderFromList(dictionaryBuffReader);
// Carrega todas as linhas de configurao (entre os macadores
// "|CONFIG|" e "|/CONFIG|")
// em uma lista.
List<String> configurationList = new ArrayList<String>();
String line = dictionaryBuffReader.readLine();
while (line != null && !line.equals("|/CONFIG|")) {
......@@ -61,35 +52,33 @@ public class PropertiesUtil {
}
}
// Separa o nome do parmetro de configurao do seu valor. Eles devem
// estar separados pelo caractere "=".
// Configuration keys and their values are identified.
// Keys and values must be separated by "=".
String[] linesArrayTemp = new String[2];
logger.info("Configuration:");
for (String lineTemp : configurationList) {
// Linhas que iniciam com %% so apenas comentrios.
// Lines between configuration tags in dictionary
// that start with %% are comments.
if (!lineTemp.startsWith("%%") && !lineTemp.isEmpty()) {
linesArrayTemp = lineTemp.split("=", 2);
if (linesArrayTemp.length == 2) {
logger.info("Name: " + linesArrayTemp[0] + " - Value: " + linesArrayTemp[1]);
listConfigFromDictionary.put(linesArrayTemp[0], linesArrayTemp[1]);
} else {
throw new Exception(
"The configuration header is not well formatted!");
throw new Exception("The configuration header is not well formatted!");
}
}
}
logger.info("Number of parameters: " + listConfigFromDictionary.size());
return listConfigFromDictionary;
}
/**
* Cria um FeatureMap com as linhas definidas entre dois marcadores.
* |Features4ALL| e |/Features4ALL|
* Create a FeatureMap with lines between |Features4ALL| e |/Features4ALL|
* tags.
*
* @param dictionaryBuffReader
* @return {@link FeatureMap}
......@@ -98,7 +87,6 @@ public class PropertiesUtil {
FeatureMap featureMap = Factory.newFeatureMap();
List<String> configLines = new ArrayList();
// Carrega todas as linhas entre os marcadores para um FeatureMap
List<String> configurationList = new ArrayList<String>();
String line = dictionaryBuffReader.readLine();
while (line != null && !line.equals("|/Features4ALL|")) {
......@@ -114,21 +102,18 @@ public class PropertiesUtil {
}
}
// Separa o nome do parmetro de configurao do seu valor. Eles devem
// estar separados pelo caractere "=".
// Features name must be separate from value by "=" character.
String[] linesArrayTemp = new String[2];
logger.info("General Features:");
for (String lineTemp : configurationList) {
// Linhas que iniciam com %% so apenas comentrios.
// Lines that start with %% are comments.
if (!lineTemp.startsWith("%%") && !lineTemp.isEmpty()) {
linesArrayTemp = lineTemp.split("=", 2);
if (linesArrayTemp.length == 2) {
logger.info("Name: " + linesArrayTemp[0] + " - Value: " + linesArrayTemp[1]);
featureMap.put(linesArrayTemp[0], linesArrayTemp[1]);
} else {
throw new Exception(
"The configuration header is not well formatted!");
throw new Exception("The configuration header is not well formatted!");
}
}
}
......
......@@ -26,7 +26,6 @@ import gate.util.OffsetComparator;
*/
public class TrieUtil {
// Contm as features de cada gazetteer.
private int totalNos = 1;
protected Logger logger;
public static final OffsetComparator OFFSET_COMPARATOR = new OffsetComparator();
......@@ -36,13 +35,16 @@ public class TrieUtil {
}
/**
* Indexa os gazetteers na trie. A raiz armazena o nvel mais profundo da
* trie.
* Entries are indexed in a trie.
* Trie root node level is set with the deepest level of trie.
*
* @param gazetBuffer
* @param gazetteerList
* @param root
* @param convertOption
* @return
* @param useTransformation
* @param encoding
* @param transformationClass
* @param transformationMethod
* @return NodeFT
* @throws Exception
*/
public NodeFT buildTrie(List<String> gazetteerList, NodeFT root, boolean useTransformation, String encoding,
......@@ -69,7 +71,7 @@ public class TrieUtil {
// used.
/*
* Entries are divided in tokens using an algorithm
* developed in this project. Do not use annie gazetteer.
* developed in this project. Do not use annie gazetteer (for now).
*/
convertedTokenList.clear();
tokenList.clear();
......@@ -169,8 +171,7 @@ public class TrieUtil {
}
/**
* Separate the entries from its features. Both are defined in the same
* line.
* Load entries and their features.
*
* @param configFileURL
* @param gazetterDelimiter
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment