Reference

Class

RiTa

Name

RiTa.kwic

Description Creates a Key-Word-In-Context (KWIC) model from a given text, a word to lookup, a wordCount and (optional) options
Syntax
RiTa.kwic(text, word, options);
Parameters
Stringthe text
Stringthe word to lookup
Object
(or Map in Java)
options (optional) the relevant options for the KWIC model:

{int} options.wordCount:
# of words/punctuation of context on either side of input word

{boolean} options.ignoreCase:
Ignore upper/lower case in the model

{boolean} options.ignoreStopWords:
Ignore words like 'the', 'and', 'a', 'of', etc, as specified in RiTa.STOP_WORDS

{boolean} options.ignorePunctuation:
Ignore punctuation tokens in the model

{String[]} options.wordsToIgnore:
A set of words (alternative stop-words, for example) to ignore.

Returns
String[]all the occurrences of the keyword in the model, each with 'wordCount' words of context on either side
Note See https://en.wikipedia.org/wiki/Concordance_%28publishing%29
Example
// Java

Map args = new HashMap();
args.put("ignoreCase", false);
args.put("ignoreStopWords", true);

String[] lines = RiTa.kwic(text, args);


// Javascript

var args = {
ignoreCase: false,
ignoreStopWords: true
};

var lines = RiTa.kwic(text, args);

Platform Java / Javascript