RiTa is implemented in Java and JavaScript, with a common API for both, and is free/libre/open-source via the GPL license.
- Smart lexicon search for words matching part-of-speech, syllable, stress and rhyme patterns
- Fast, heuristic algorithms for inflection, conjugation, stemming, tokenization, and more
- Letter-to-sound engine for feature analysis of arbitrary words (with/without lexicon)
- Integration of the RiScript scripting language, designed for writers
- Powerful new options for generation via grammars and Markov chains
- For JavaScript, see this repo or use it with npm or unpkg
- A simple Processing example
- A simple Java example
- For Developers
Note: Version 2.0 contains breaking changes! Please check the release notes
- Via github packages
- Via maven central
- Or directly in maven:
<dependency>
<groupId>org.rednoise</groupId>
<artifactId>rita</artifactId>
<version>2.4</version>
</dependency>
RiScript is a simple, writer-focused scripting language included in RiTa. It enables several generative primitives within plain text for expansion at runtime. RiScript primitives can be used as part of any RiTa grammar or executed directly using RiTa.evaluate(). For documentation, see this interactive notebook.
$ git clone https://github.com/dhowe/rita4j.git
$ cd rita4j
$ mvn install # when done, you should see "BUILD SUCCESS"
The project requires a minimum version of Java 8 and Maven 3.6 to build.
- Do steps above under Developing
- In eclipse, File->Import->Maven->Existing Maven Projects and select your 'rita4j' folder
- Right-click on project, and select 'Run-as' -> 'Maven install' or 'JUnit tests'
Please make contributions via fork-and-pull - thanks!
For online examples in JavaScript, see this page
- Create a new Java project in Eclipse (or your IDE of choice)
- Download rita.jar and add it to the build path for the project. In eclipse: 'Project' > 'Properties' > 'Java Build Path' > 'Libraries' > 'Add External JARs...'
- Create and run a new class, SimpleExample.java, with the following code:
import rita.*;
public class SimpleExample {
public static void main(String[] args) {
System.out.println(RiTa.analyze("The elephant took a bite!"));
}
}
To install:
- Open Processing and select 'Sketch' menu > 'Import Library...' > 'Add Library...'
- Search for 'RiTa' and then install it
Create an example sketch as follows (and/or see the included examples):
import rita.*;
import java.util.*;
void setup() {
size(600, 200);
background(50);
textSize(20);
noStroke();
Map data = RiTa.analyze("The elephant took a bite!");
float y = 15;
for (Iterator it = data.keySet().iterator(); it.hasNext();) {
String key = (String) it.next();
text(key + ": " + data.get(key), 25, y += 26);
}
}
This project exists only because of the people who contribute. Thank you!