A set of sampling APIs for text stream and a command-line utility based on the API