Getting started === To run the service: mvn tomcat7:run The service starts on port 9090. When sending JSON requests, make sure to set the Content-Type header to "application/json". To run tests: mvn test This code was developed and tested with JRE 1.8.0_112 and Maven 3.3.9 on macOS 10.12.2. Functional notes === No concern at all was given to escaping characters. For example, the '&' character is used as a delimiter but could conceivably appear in a phrase as well. Also no concern at all was given to encoding. Requests and responses are assumed to be UTF-8 strings. For the /format endpoint, no validation is performed on token counts, in other words the service does not do tokenization, it transparently passes token counts back. In case of syntax errors the request will fail in its entirety; there is no attempt to recover and/or return a partial result. For the /ngram endpoint, a _token_ is composed of alphanumeric characters only, i.e. letters and digits. All other characters, punctuation, question marks, etc, are ignored.