If string run(string) is the interface to the C++ code, let's wrap it in something that returns a vector of reals.
Also, this input string here must have the form "token 5 word 2 the 4" which is annoying.
Add another method that takes a vector of tokens and creates this string to pass in to the C++ code.

The final interface would be then be much more natural:  list_reals = infer(list of tokens).