/** * Initialise a HalfPhoneLeftRight feature processor. */ public HalfPhoneLeftRight() { this.values = new ByteStringTranslator(new String[] { "0", "L", "R" }); }
/** * Combine the elements of the given string array into a single string, containing one array element per line. * * @param stringArray * stringArray * @param startIndex * startIndex * @return toString(stringArray, startIndex, stringArray.length - 1) */ public static String toString(String[] stringArray, int startIndex) { return toString(stringArray, startIndex, stringArray.length - 1); }
public WeightedCodebookFeatureCollection(WeightedCodebookTrainerParams params, int numFiles) { if (numFiles > 0) indexMapFiles = StringUtils.indexedNameGenerator(params.trainingBaseFolder + params.codebookHeader.sourceTag + "_" + params.codebookHeader.targetTag + "_", numFiles, 1, "", params.indexMapFileExtension); else indexMapFiles = null; }
@Override public String[] getValues() { return values.getStringValues(); } }
public static String[] readTextFile(String textFile, String encoding) throws IOException { String[][] tmp = readTextFileInRows(textFile, encoding, 1); String[] strRet = new String[tmp.length]; for (int i = 0; i < tmp.length; i++) strRet[i] = tmp[i][0]; return strRet; }
public static float[] string2float(String[] strs) { float[] values = null; if (strs != null && strs.length > 0) { values = new float[strs.length]; for (int i = 0; i < strs.length; i++) values[i] = string2float(strs[i]); } return values; }
public static String[] getDifferentItemsList(String[] items) { String[] differentItems = null; int[] indices = getDifferentItemsIndices(items); if (indices != null) { differentItems = new String[indices.length]; for (int i = 0; i < indices.length; i++) differentItems[i] = items[indices[i]]; } return differentItems; }
/** * Translate between a feature name and a feature index. * * @param featureName * a valid feature name * @return a feature index, as could be used to access a feature value in a FeatureVector. * @throws IllegalArgumentException * if the feature name is unknown. */ public int getFeatureIndex(String featureName) { return featureNames.get(featureName); }
/** * Format method for the f conversion character. * * @param x * the double to format. * @return the formatted String. */ private String printFFormat(double x) { return fFormatString(x); }
/** * Indicate whether the feature definition contains the feature with the given name * * @param name * the feature name in question, e.g. "next_next_phone" * @return featureNames.contains(name) */ public boolean hasFeature(String name) { return featureNames.contains(name); }
public PhoneFeature(AllophoneSet phoneSet, String name, String phonesetQuery, String[] possibleValues, String pauseSymbol, TargetElementNavigator segmentNavigator) { this.phoneSet = phoneSet; this.name = name; this.phonesetQuery = phonesetQuery; this.values = new ByteStringTranslator(possibleValues); this.navigator = segmentNavigator; }
/** * Combine the elements of the given string array into a single string, containing one array element per line. * * @param stringArray * stringArray * @return toString(stringArray, 0) */ public static String toString(String[] stringArray) { return toString(stringArray, 0); }
@Override public String[] getValues() { return values.getStringValues(); } }
public WeightedCodebookFeatureCollection(WeightedCodebookTrainerParams params, int numFiles) { if (numFiles > 0) indexMapFiles = StringUtils.indexedNameGenerator(params.trainingBaseFolder + params.codebookHeader.sourceTag + "_" + params.codebookHeader.targetTag + "_", numFiles, 1, "", params.indexMapFileExtension); else indexMapFiles = null; }
public static int[] getDifferentItemsList(int[] items) { int[] differentItems = null; int[] indices = getDifferentItemsIndices(items); if (indices != null) { differentItems = new int[indices.length]; for (int i = 0; i < indices.length; i++) differentItems[i] = items[indices[i]]; } return differentItems; }
/** * Translate between a feature index and a feature name. * * @param index * a feature index, as could be used to access a feature value in a FeatureVector. * @return the name of the feature corresponding to the index * @throws IndexOutOfBoundsException * if index<0 or index>getNumberOfFeatures() */ public String getFeatureName(int index) { return featureNames.get(index); }
public Pos(String aName, String[] posValues, TargetElementNavigator wordNavi) { this.values = new ByteStringTranslator(posValues); this.navigator = wordNavi; this.name = aName; }
/** * Combine the elements of the given string array into a single string, containing one array element per line. * * @param stringArray * stringArray * @param startIndex * startIndex * @return toString(stringArray, startIndex, stringArray.length - 1) */ public static String toString(String[] stringArray, int startIndex) { return toString(stringArray, startIndex, stringArray.length - 1); }
public static String[] getDifferentItemsList(String[] items) { String[] differentItems = null; int[] indices = getDifferentItemsIndices(items); if (indices != null) { differentItems = new String[indices.length]; for (int i = 0; i < indices.length; i++) differentItems[i] = items[indices[i]]; } return differentItems; }
public TobiAccent(String name, TargetElementNavigator syllableNavigator) { this.name = name; this.navigator = syllableNavigator; this.values = new ByteStringTranslator(new String[] { "0", "*", "H*", "!H*", "^H*", "L*", "L+H*", "L*+H", "L+!H*", "L*+!H", "L+^H*", "L*+^H", "H+L*", "H+!H*", "H+^H*", "!H+!H*", "^H+!H*", "^H+^H*", "H*+L", "!H*+L" }); }