/RiTaV1

RiTa: the generative language toolkit

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

*** This repository is deprecated. See the current version of RiTa HERE. ***


RiTa: the generative language toolkit

RiTa is designed to be an easy-to-use toolkit for experiments in natural language and generative literature. It is implemented in Java and JavaScript (with a unified API for both) and optionally integrates with Processing, Android, Node, p5.js, Browserify, Bower, etc. It is free/libre and open-source via the GPL license (http://www.gnu.org/licenses/gpl.txt).

Please see https://github.com/dhowe/RiTaJS for the JavaScript implementation of RiTa.

About the project

Support us with a monthly donation and become a backer!


A Simple Example (Java)

    For JavaScript examples, go here

  1. Create a new Java project in Eclipse (or your IDE of choice)
  2. Download rita.jar and add it to the build path for the project. In eclipse: 'Project' > 'Properties' > 'Java Build Path' > 'Libraries' > 'Add External JARs...'
  3. Create and run a new class, SimpleExample.java, with the following code:
import rita.*;

public class SimpleExample {

  public static void main(String[] args) {

    RiString rs = new RiString("The elephant took a bite!");
    System.out.println(rs.features());
  }
}

In Processing

To install:

  1. Open Processing and select 'Sketch' menu > 'Import Library...' > 'Add Library...'
  2. 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();

  RiString rs = new RiString("The elephant took a bite!");
  Map data = rs.features();

  float y = 15;
  for (Iterator it = data.keySet().iterator(); it.hasNext();) {
    String key = (String) it.next();
    text(key + ": " + data.get(key), 25, y += 26);
  }
}

In Processing (Android-mode)

  1. If RiTa library is not installed, open Processing and select 'Sketch' menu > 'Import Library...' > 'Add Library...'
  2. Search for 'RiTa' and then install it
  3. Follow these instructions to setup your environment, OR follow steps 4-6 below
  4. Switch to Android mode in Processing 3.x on PC or Mac by clicking the 'Java' button on the upper-right of the UI, then select 'Add Mode...'
  5. Select 'Android Mode' from 'Contribution Manager' window and then install it and the required Android SDK when prompted
  6. Restart Processing and input the example sketch below
  7. Switch to 'Android' mode by clicking the 'Java' button
  8. Connect your Android device to your PC via a USB cable
  9. On your Android device, go to ‘Settings’ - ‘About phone’ and tap on ‘Build number’ for five times to become a developer 10.Go back to ‘Settings’, go to ‘Developer options’ and switch on ‘USB debugging'
  10. Run the example sketch

An example sketch:

import rita.*;
import java.util.*;

void setup() {

  size(600, 200);
  background(50);
  textSize(20);
  noStroke();

  RiString rs = new RiString("The elephant took a bite!");
  Map data = rs.features();

  float y = 15;
  for (Iterator it = data.keySet().iterator(); it.hasNext();) {
    String key = (String) it.next();
    text(key + ": " + data.get(key), 25, y += 26);
  }
}

Can I contribute?

Please! We are looking for more coders to help out... Just press Fork at the top of this page and get started, or follow the instructions below...

If you don't feel like coding but still want to contribute, please send a twitter message to @RiTaSoftware.


Development Setup (in Eclipse)

  1. Download and install Eclipse for Java.

  2. In the Eclipse menu, select 'File' > 'Import...'

  3. In the 'Import Window' select 'Git' > 'Projects from Git', then press Next.

  4. Select 'Clone URI' > then Next and copy and paste the 'HTTPS clone URL' https://github.com/dhowe/RiTa.git from RiTa's Github page into the URI field.

  5. Press Next to proceed with the default master branch or (optionally) configure the project directory.

  6. Press Next and select 'Import existing projects' to finish.

  7. Right click on 'pom.xml' from RiTa root directory in Package Explorer panel in Eclipse and select 'Run as' > 'Maven install'.

  8. To run the tests:

    a. Navigate to the RiTa/resources directory and right-click on 'build.xml'

    b. Select 'Run as' > 'Ant Build' to compile and run the tests in JUnit.

  9. To build the project:

    a. In the Eclipse menu, select 'Window' > 'Show View' -> 'Ant

    b. Click the 'Add buildfile' button to add a buildfile in the newly added Ant panel, and navigate to RiTa/resources/build.xml

    c. Click to expand the 'RiTa' menu and reveal the various tasks, then double-click 'build' (or run $ cd RiTa/resources && ant build from the terminal)

    d. (Optional) if you are on Windows, you can use cygwin, by installing ant and using it to run the command $ cd RiTa/resources && ant build.

    e. When the build is complete, project resources can be found in RiTa/dist

  10. Work on an existing issue, then submit a pull request...

  11. (Optional) If you encounter error java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version, follow these instructions to install Maven manually.


Contributors

Code Contributors

This project exists only because of the people who contribute. Thank you! [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]