Temporary java prototype to support text generation.