marytts.util.string
Class StringUtils

java.lang.Object
  extended by marytts.util.string.StringUtils

public class StringUtils
extends java.lang.Object


Constructor Summary
StringUtils()
           
 
Method Summary
static int[][] alignLabels(Label[] seq1, Label[] seq2)
           
static int[][] alignLabels(Label[] labs1, Label[] labs2, double PDeletion, double PInsertion, double PSubstitution)
           
static java.lang.String checkFirstDot(java.lang.String strIn)
           
static java.lang.String checkLastSlash(java.lang.String strIn)
           
static java.lang.String deblank(java.lang.String str)
           
static int[] find(java.lang.String str, char ch)
           
static int[] find(java.lang.String str, char ch, int stInd)
           
static int[] find(java.lang.String str, char ch, int stInd, int enInd)
           
static int findInMap(int[][] map, int ind0)
           
static int findInMapReverse(int[][] map, int ind1)
           
static int[] getDifferentItemsIndices(int[] items)
           
static int[] getDifferentItemsIndices(java.lang.String[] items)
           
static int[] getDifferentItemsList(int[] items)
           
static java.lang.String[] getDifferentItemsList(java.lang.String[] items)
           
static java.lang.String getFileExtension(java.lang.String strFilename, boolean isIncludeDot)
          Deprecated. use FilenameUtils.getExtension(String) instead
static java.lang.String getFileName(java.lang.String fullpathFilename)
           
static java.lang.String getFileName(java.lang.String fullpathFilename, boolean bRemoveExtension)
           
static java.lang.String getFolderName(java.lang.String fullpathFilename)
          Deprecated. use FilenameUtils.getFullPath(String) instead
static java.lang.String getRandomFileName(java.lang.String preName, int randomNameLength, java.lang.String fileExtension)
           
static java.lang.String getRandomName(int randomNameLength)
           
static java.lang.String getRandomName(java.lang.String preName, int randomNameLength)
           
static java.lang.String getRandomName(java.lang.String preName, int randomNameLength, java.lang.String postName)
           
static java.lang.String[] indexedNameGenerator(java.lang.String preName, int numFiles)
           
static java.lang.String[] indexedNameGenerator(java.lang.String preName, int numFiles, int startIndex)
           
static java.lang.String[] indexedNameGenerator(java.lang.String preName, int numFiles, int startIndex, java.lang.String postName)
           
static java.lang.String[] indexedNameGenerator(java.lang.String preName, int numFiles, int startIndex, java.lang.String postName, java.lang.String extension)
           
static java.lang.String[] indexedNameGenerator(java.lang.String preName, int numFiles, int startIndex, java.lang.String postName, java.lang.String extension, int numDigits)
           
static boolean isDesired(int currentFeature, int desiredFeatures)
           
static boolean isDesired(int currentFeature, int desiredFeatures, int maxFeatureStringLen)
           
static boolean isLetterOrModifier(int codePoint)
          Determine whether the given codepoint is either a letter or a modifier according to the Unicode standard.
static boolean isNumeric(java.lang.String str)
           
static boolean isOneOf(java.lang.String item, java.lang.String[] list)
           
static void main(java.lang.String[] args)
           
static java.lang.String modifyExtension(java.lang.String strFilename, java.lang.String desiredExtension)
           
static java.lang.String[][] parseFromLines(java.lang.String[] lines, int minimumItemsInOneLine, int startLine, int endLine)
           
static java.util.Vector<java.lang.String> processVoiceExampleText(java.lang.String text)
          Divides the example text of a voice into sentences in a vector
static java.lang.String purgeNonBreakingSpaces(java.lang.String input)
          Purge non-breaking spaces from input by replacing them with regular spaces.
static java.lang.String[] readTextFile(java.lang.String textFile)
           
static java.lang.String[] readTextFile(java.lang.String textFile, java.lang.String encoding)
           
static java.lang.String[][] readTextFileInRows(java.lang.String textFile, java.lang.String encoding, int minimumItemsInOneLine)
           
static java.lang.String readTextFileIntoString(java.lang.String textFile, java.lang.String encoding)
          Deprecated. use FileUtils.readFileToString(File, String) instead
static java.lang.String removeLastSlash(java.lang.String strIn)
           
static java.lang.String replace(java.lang.String str, java.lang.String pattern, java.lang.String replacement)
           
static double string2double(java.lang.String str)
           
static double[] string2double(java.lang.String[] strs)
           
static float string2float(java.lang.String str)
           
static float[] string2float(java.lang.String[] strs)
           
static int string2int(java.lang.String str)
           
static int[] string2int(java.lang.String[] strs)
           
static java.io.InputStream toInputStream(java.lang.String str)
           
static java.io.InputStream toInputStream(java.lang.String[] stringArray)
           
static java.io.InputStream toInputStream(java.lang.String[] stringArray, int startIndex)
           
static java.io.InputStream toInputStream(java.lang.String[] stringArray, int startIndex, int endIndex)
           
static java.lang.String toString(ComplexNumber[][] array)
           
static java.lang.String toString(double[][] array)
           
static java.lang.String toString(java.lang.String[] stringArray)
          Combine the elements of the given string array into a single string, containing one array element per line.
static java.lang.String toString(java.lang.String[] stringArray, int startIndex)
          Combine the elements of the given string array into a single string, containing one array element per line.
static java.lang.String toString(java.lang.String[] stringArray, int startIndex, int endIndex)
          Combine the elements of the given string array into a single string, containing one array element per line.
static java.lang.String[] toStringArray(java.lang.String allInOneLine)
           
static java.lang.String[] toStringLines(ComplexArray x)
           
static java.lang.String[] toStringLines(ComplexNumber[] x)
           
static java.lang.String[] toStringLines(double[] x)
           
static java.lang.String[] toStringLines(float[] x)
           
static java.lang.String[] toStringLines(int[] x)
           
static java.lang.String urlDecode(java.lang.String strRequest)
           
static java.lang.String urlEncode(java.lang.String strRequest)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtils

public StringUtils()
Method Detail

deblank

public static java.lang.String deblank(java.lang.String str)

string2float

public static float string2float(java.lang.String str)

string2double

public static double string2double(java.lang.String str)

string2int

public static int string2int(java.lang.String str)

string2float

public static float[] string2float(java.lang.String[] strs)

string2double

public static double[] string2double(java.lang.String[] strs)

string2int

public static int[] string2int(java.lang.String[] strs)

find

public static int[] find(java.lang.String str,
                         char ch,
                         int stInd,
                         int enInd)

find

public static int[] find(java.lang.String str,
                         char ch,
                         int stInd)

find

public static int[] find(java.lang.String str,
                         char ch)

checkLastSlash

public static java.lang.String checkLastSlash(java.lang.String strIn)

removeLastSlash

public static java.lang.String removeLastSlash(java.lang.String strIn)

purgeNonBreakingSpaces

public static java.lang.String purgeNonBreakingSpaces(java.lang.String input)
Purge non-breaking spaces from input by replacing them with regular spaces.

Parameters:
input - to purge
Returns:
purged input

checkFirstDot

public static java.lang.String checkFirstDot(java.lang.String strIn)

indexedNameGenerator

public static java.lang.String[] indexedNameGenerator(java.lang.String preName,
                                                      int numFiles)

indexedNameGenerator

public static java.lang.String[] indexedNameGenerator(java.lang.String preName,
                                                      int numFiles,
                                                      int startIndex)

indexedNameGenerator

public static java.lang.String[] indexedNameGenerator(java.lang.String preName,
                                                      int numFiles,
                                                      int startIndex,
                                                      java.lang.String postName)

indexedNameGenerator

public static java.lang.String[] indexedNameGenerator(java.lang.String preName,
                                                      int numFiles,
                                                      int startIndex,
                                                      java.lang.String postName,
                                                      java.lang.String extension)

indexedNameGenerator

public static java.lang.String[] indexedNameGenerator(java.lang.String preName,
                                                      int numFiles,
                                                      int startIndex,
                                                      java.lang.String postName,
                                                      java.lang.String extension,
                                                      int numDigits)

modifyExtension

public static java.lang.String modifyExtension(java.lang.String strFilename,
                                               java.lang.String desiredExtension)

getFileExtension

@Deprecated
public static java.lang.String getFileExtension(java.lang.String strFilename,
                                                           boolean isIncludeDot)
Deprecated. use FilenameUtils.getExtension(String) instead

Parameters:
strFilename -
isIncludeDot -
Returns:

alignLabels

public static int[][] alignLabels(Label[] seq1,
                                  Label[] seq2)

alignLabels

public static int[][] alignLabels(Label[] labs1,
                                  Label[] labs2,
                                  double PDeletion,
                                  double PInsertion,
                                  double PSubstitution)

findInMap

public static int findInMap(int[][] map,
                            int ind0)

findInMapReverse

public static int findInMapReverse(int[][] map,
                                   int ind1)

isNumeric

public static boolean isNumeric(java.lang.String str)

getFileName

public static java.lang.String getFileName(java.lang.String fullpathFilename,
                                           boolean bRemoveExtension)

getFileName

public static java.lang.String getFileName(java.lang.String fullpathFilename)

getFolderName

@Deprecated
public static java.lang.String getFolderName(java.lang.String fullpathFilename)
Deprecated. use FilenameUtils.getFullPath(String) instead

Parameters:
fullpathFilename -
Returns:

readTextFile

public static java.lang.String[] readTextFile(java.lang.String textFile)

readTextFile

public static java.lang.String[] readTextFile(java.lang.String textFile,
                                              java.lang.String encoding)

readTextFileInRows

public static java.lang.String[][] readTextFileInRows(java.lang.String textFile,
                                                      java.lang.String encoding,
                                                      int minimumItemsInOneLine)

readTextFileIntoString

@Deprecated
public static java.lang.String readTextFileIntoString(java.lang.String textFile,
                                                                 java.lang.String encoding)
Deprecated. use FileUtils.readFileToString(File, String) instead

Read text file as a single concatenated string

Parameters:
textFile -
encoding -
Returns:

parseFromLines

public static java.lang.String[][] parseFromLines(java.lang.String[] lines,
                                                  int minimumItemsInOneLine,
                                                  int startLine,
                                                  int endLine)

getDifferentItemsList

public static int[] getDifferentItemsList(int[] items)

getDifferentItemsIndices

public static int[] getDifferentItemsIndices(int[] items)

getDifferentItemsList

public static java.lang.String[] getDifferentItemsList(java.lang.String[] items)

getDifferentItemsIndices

public static int[] getDifferentItemsIndices(java.lang.String[] items)

isDesired

public static boolean isDesired(int currentFeature,
                                int desiredFeatures)

isDesired

public static boolean isDesired(int currentFeature,
                                int desiredFeatures,
                                int maxFeatureStringLen)

getRandomName

public static java.lang.String getRandomName(int randomNameLength)

getRandomName

public static java.lang.String getRandomName(java.lang.String preName,
                                             int randomNameLength)

getRandomName

public static java.lang.String getRandomName(java.lang.String preName,
                                             int randomNameLength,
                                             java.lang.String postName)

getRandomFileName

public static java.lang.String getRandomFileName(java.lang.String preName,
                                                 int randomNameLength,
                                                 java.lang.String fileExtension)

isOneOf

public static boolean isOneOf(java.lang.String item,
                              java.lang.String[] list)

toStringArray

public static java.lang.String[] toStringArray(java.lang.String allInOneLine)

toInputStream

public static java.io.InputStream toInputStream(java.lang.String str)

toInputStream

public static java.io.InputStream toInputStream(java.lang.String[] stringArray)

toInputStream

public static java.io.InputStream toInputStream(java.lang.String[] stringArray,
                                                int startIndex)

toInputStream

public static java.io.InputStream toInputStream(java.lang.String[] stringArray,
                                                int startIndex,
                                                int endIndex)

toString

public static java.lang.String toString(java.lang.String[] stringArray)
Combine the elements of the given string array into a single string, containing one array element per line.

Parameters:
stringArray -
Returns:

toString

public static java.lang.String toString(java.lang.String[] stringArray,
                                        int startIndex)
Combine the elements of the given string array into a single string, containing one array element per line.

Parameters:
stringArray -
startIndex -
Returns:

toString

public static java.lang.String toString(java.lang.String[] stringArray,
                                        int startIndex,
                                        int endIndex)
Combine the elements of the given string array into a single string, containing one array element per line.

Parameters:
stringArray -
startIndex -
endIndex -
Returns:

replace

public static java.lang.String replace(java.lang.String str,
                                       java.lang.String pattern,
                                       java.lang.String replacement)

urlEncode

public static java.lang.String urlEncode(java.lang.String strRequest)

urlDecode

public static java.lang.String urlDecode(java.lang.String strRequest)

processVoiceExampleText

public static java.util.Vector<java.lang.String> processVoiceExampleText(java.lang.String text)
Divides the example text of a voice into sentences in a vector

Parameters:
text - the example text
Returns:
vector of example sentences

toString

public static java.lang.String toString(ComplexNumber[][] array)

toString

public static java.lang.String toString(double[][] array)

isLetterOrModifier

public static boolean isLetterOrModifier(int codePoint)
Determine whether the given codepoint is either a letter or a modifier according to the Unicode standard. More precisely, this returns true if codepoint belongs to one of the following categories as defined at http://unicode.org/Public/UNIDATA/UCD.html#General_Category_Values: Whether a given character is associated with this category can be looked up at http://unicode.org/Public/UNIDATA/UnicodeData.txt

Parameters:
codePoint - the unicode codepoint as determined e.g. by String.codePointAt().
Returns:
true if the above condition is met, false otherwise

toStringLines

public static java.lang.String[] toStringLines(double[] x)

toStringLines

public static java.lang.String[] toStringLines(float[] x)

toStringLines

public static java.lang.String[] toStringLines(int[] x)

toStringLines

public static java.lang.String[] toStringLines(ComplexNumber[] x)

toStringLines

public static java.lang.String[] toStringLines(ComplexArray x)

main

public static void main(java.lang.String[] args)