# Initialisation first
require 'rubygems'
require 'Rjb'

# Make sure that the Sentistrength library is in your lib/ directory, or change the path accordingly  (this cmd should return "nil")
Rjb::load('lib/SentiStrength/SentiStrength.jar')

# Import the SentiStrength Library
instance = Rjb::import("uk.ac.wlv.sentistrength.SentiStrength")

# You should make sure the path below to the Sentistrength Library exists
senti = instance.main(["sentidata", 'lib/SentiStrength/', "text", "I love you"])
senti = instance.new

# Interact with the library
result = senti.computeSentimentScores("i love you")

# This returns:
# => "3 -1"

result.split(" ").collect{|i| i.to_i}
