RiTa
index
Name RiAnalyzer
Description Analyzes String phrases, annotating each phrase and each contained word with 'feature' data. Default features include: word-boundaries, pos, phonemes, stresses, syllables, etc.

    String text = "The boy jumped over the wild dog.";
    RiAnalyzer ra = new RiAnalyzer(this);
    ra.analyze(text);

    String phonemes = ra.getPhonemes();   
    String stresses = ra.getStresses();
    String syllables = ra.getSyllables();
    String partsOfSpeech = ra.getPos();
Note: RiString (and RiText) objects can also be analyzed:
      RiString rt = new RiString("The boy ran to the store.");
      ra.analyze(rt);
      String phonemes = rt.getPhonemes();
And additional (custom) features can be added by the user by creating a subclass and overriding the analyze method as follows:
      RiAnalyzer ra = new RiAnalyzer(this) {
        public void analyze(RiText rt) {
          super.analyze(rt);
          // add custom features here
          rt.addFeature("featureName", "featureValue");
        }
      };
Constructors
RiAnalyzer(pApplet);
RiAnalyzer(pApplet, taggerType, enableCaching);
RiAnalyzer(pApplet, enableCaching);
Methods
analyze()   Sets text as the current phrase and analyzes it, so that subsequent calls to methods like getPos(), getPhonemes(), getSyllables(), etc. will return immediately.

dumpFeatures()   Prints the features of the last analyzed text to System.out

firstIdx()   Returns the (1st) index of word or -1 if not found

getAvailableFeatures()   Returns the Set of available features

getCallCount()   Returns the number of non-cached lookups made by this object so far

getFeature()   Returns the feature specified by name.

Note: getFeature("pos") is equivalent to getPos().

getFeatures()   Returns a Map (of String key-value pairs) of all the features for the word at the specified word-index.

getFeatureString()   Returns a String representation of the feature list for the last analyzed text

getPhonemes()   Returns a String containing all phonemes for the input text, delimited by semi-colons, e.g., "dh:ax:d:ao:g:r:ae:n:f:ae:s:t", or null if no text has been input.

getPhonemesAt()   Returns the phonemes for the word at wordIdx

getPos()   Returns a String containing all pos tags for the input text, delimited by semi-colons, e.g., "dt:nn:vbd:rb", or null if no text has been input.

getPosAt()   Returns the pos for the word at wordIdx

getStresses()   Returns a String containing the stresses for each syllable of the input text, delimited by semi-colons, e.g., "0:1:0:1", with 1's meaning 'stressed', and 0's meaning 'unstressed', or null if no text has been input.

getStressesAt()   Returns the stresses for the word at wordIdx

getSyllables()   Returns a String containing the phonemes for each syllable of each word of the input text, delimited by dashes (phonemes) and semi-colons (words), e.g., "dh-ax:d-ao-g:r-ae-n:f-ae-s-t" for the 4 syllables of the phrase 'The dog ran fast', or null if no text has been input.

getText()   Returns the last analyzed text

getTokens()   Returns an array of the words (no punctuation) in the current text, or null if no text has been input.

lastIdx()   Returns the index of the last token matching word or -1 if not found

rhymeScheme()   Returns the rhyme scheme for a given set of lines.

Note: assumes all rhymes are end-rhymes, that is, happening on the last word of the lines.

tokenAt()   Returns the word at index wordIdx

wordCount()   Returns the # of words in the current text

Usage Web & Application