|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.cmu.minorthird.util.LineProcessingUtil
public class LineProcessingUtil
Line processing utilities. Matcher for regular expressions, adding features to stringBuffer in svmformat, etc
Constructor Summary | |
---|---|
LineProcessingUtil()
|
Method Summary | |
---|---|
static void |
addFeature(java.lang.String line,
java.lang.String regexp,
java.lang.String featureName,
java.lang.StringBuffer features_out)
If the line substring matches the regexp, it adds a " featurename=1" to the string buffer It is useful for producing external datasets in Minorthird format |
static double |
AtoZPercentage(java.lang.String line)
Returns the percentage of A-Z or a-z characters in a line |
static java.lang.String[] |
getMessageLines(java.lang.String tmp)
Method to split a message (string format) into lines |
static int |
indentNumber(java.lang.String line)
|
static double |
indentPercentage(java.lang.String line)
returns the percentage of tabs in a line |
static boolean |
lineMatcher(java.lang.String patternStr,
java.lang.String tmpstr)
Returns true if substring in input (or part of it) matches the pattern. |
static int |
numberOfMatches(java.lang.String expression,
java.lang.String line)
|
static double |
punctuationPercentage(java.lang.String line)
Returns the percentage of punctuation (\p{punct}) characters in a line |
static TextLabels |
readBsh(java.io.File dir,
java.io.File envfile)
|
static java.lang.String |
readFile(java.lang.String in)
Method to read a file and turn it into a string - based on rcwang's code |
static boolean |
startWithSameInitialPunctCharacters(java.lang.String tmp,
java.lang.String tmp1)
detect a sequence of 2 lines starting with the same punctuation (\p{Punct}) character |
static double |
wordCharactersPercentage(java.lang.String line)
Returns the percentage characters [\w] in a line |
static void |
writeToOutputFile(java.lang.String outputFileName,
java.lang.StringBuffer aux)
Writes the contents of a String Buffer to an output file |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LineProcessingUtil()
Method Detail |
---|
public static boolean lineMatcher(java.lang.String patternStr, java.lang.String tmpstr)
patternStr
- regexp (in String format)tmpstr
- line to be matched to regexp (in String format)
public static void addFeature(java.lang.String line, java.lang.String regexp, java.lang.String featureName, java.lang.StringBuffer features_out)
line
- in String formatregexp
- in String formatfeatureName
- feature name to be added, in case the regexp matches the line substringfeatures_out
- StringBuffer to which the feature should be addedpublic static double punctuationPercentage(java.lang.String line)
line
- in String format
public static double AtoZPercentage(java.lang.String line)
line
- in String format
public static double wordCharactersPercentage(java.lang.String line)
line
- in String format
public static double indentPercentage(java.lang.String line)
line
- in String format
public static int indentNumber(java.lang.String line)
public static int numberOfMatches(java.lang.String expression, java.lang.String line)
public static boolean startWithSameInitialPunctCharacters(java.lang.String tmp, java.lang.String tmp1)
tmp
- line1 in String formattmp1
- line2 in String format
public static java.lang.String[] getMessageLines(java.lang.String tmp)
tmp
- message as String
public static java.lang.String readFile(java.lang.String in) throws java.io.IOException
in
- String with the name of file
java.io.IOException
public static void writeToOutputFile(java.lang.String outputFileName, java.lang.StringBuffer aux) throws java.io.IOException
outputFileName
- output File name (as a String)aux
- string buffer to be written to output file
java.io.IOException
public static TextLabels readBsh(java.io.File dir, java.io.File envfile) throws java.lang.Exception
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |