RiTa
index
Name RiString
Description RiTa's version of the Java String object (both implement the CharSequence interface) with support for 'features'; key-value pairs that contain additional information about the object. For example, you can add part-of-speech, phonemes, syllables, and stress features to a RiString object as follows:
    RiString rs = new RiString("The dog was white");
    RiAnalyzer ra = new RiAnalyzer();
    ra.analyze(rs);

    System.out.println(rs.getFeature("syllables"));
    System.out.println(rs.getFeature("phonemes"));    
    System.out.println(rs.getFeature("stresses"));
    System.out.println(rs.getFeature("pos"));
Constructors
RiString(s);
Methods
charAt()  

compareTo()  

compareToIgnoreCase()  

concat()  

contains()  

contentEquals()  

RiString.copy()   Creates and returns a copy of riString

dump()  

endsWith()  

equals()  

equalsIgnoreCase()  

firstIndexOf()   Returns the index of the first token matching word or -1 if not found

getBytes()  

getChars()  

getPos()  

getPosArr()   Returns an array of part-of-speech tags, one per word, using the default WordTokenizer & PosParser...

getPosAt()   Returns the part-of-speech at wordIdx using the default WordTokenizer & PosParser...

getText()  

getWordAt()   Returns the word at wordIdx using the default WordTokenizer.

getWordCount()   Returns the # of words in the object according to the default WordTokenizer.

getWords()   Returns the array of words in the object, via a call to RiTa.tokenize().

hashCode()  

indexOf()  

insertWordAt()   Inserts newWord at wordIdx and shifts each subsequent word accordingly. Returns true if the replace was succesful, or false if the index does not exist.

intern()  

join()  

lastIndexOf()  

length()  

matches()  

regionMatches()  

replace()   Replaces all instances of oldText with newText in the object.

replaceAll()  

replaceCharAt()   Replaces the character at 'idx' with 'replaceWith'. If the specified 'idx' is less than xero, or beyond the length of the current text, there will be no effect. Returns true if the replacement was made

replaceFirst()  

replaceWordAt()   Replaces the word at wordIdx with newWord. Returns true if the replace was succesful, or false if the index does not exist.

setString()  

setText()   Sets the current text to this String

split()   Splits the RiString as per String.split(regex), then checks for any features with the same number of elements as the resulting String[] and adds the appropriate feature to each individual RiString.
Example:
'only a handful of responses' / {chunk=noun-phrase}, {pos=rb dt nn in nns} ->
  • 'only' / {pos=rb}
  • 'a' / {pos=dt}
  • 'handful' / {pos=nn}
  • 'of' / {pos=in}
  • 'responses' / {pos=nns}


startsWith()  

subSequence()  

substring()  

toCharArray()  

toLowerCase()  

toString()  

toUpperCase()  

trim()  

RiString.delete()  

RiString.fromCollection()  

RiString.fromStrings()  

RiString.regexMatch()   Utility method to test whether a String partially matches a regex pattern.

RiString.regexReplace()   Utility method to do regex replacement on a String

Usage Web & Application