Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

23 lines (21 sloc) 0.518 kb
require 'rubygems'
require 'sinatra'
require 'erb'
require 'json'
require 'lib/segmenter'
get "/" do
erb :index
end
get "/segmenter" do
if !params['text'] || !params['callback']
"#{params['callback']}({'error' : 'Must include both 'text' and 'callback' parameter.'})"
else
begin
segmented = segment(params['text'])
result = JSON(segmented)
"#{params['callback']}(#{result})"
rescue StandardError => e
"#{params['callback']}({'error' : '#{e.message}'})"
end
end
end
Jump to Line
Something went wrong with that request. Please try again.