Documentation ¶
Index ¶
- func AnalyzeHandler(rw http.ResponseWriter, r *http.Request)
- func JSONResponse(rw http.ResponseWriter, b []byte)
- func RankHandler(rw http.ResponseWriter, r *http.Request)
- func SplitHandler(rw http.ResponseWriter, r *http.Request)
- func WordsHandler(rw http.ResponseWriter, r *http.Request)
- type AnalyzeResponse
- type Operations
- type RankResponse
- type SplitResponse
- type Word
- type WordsResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnalyzeHandler ¶
func AnalyzeHandler(rw http.ResponseWriter, r *http.Request)
AnalyzeHandler takes a text and returns statistics on the composition: number of characters, words, rank and more.
func JSONResponse ¶
func JSONResponse(rw http.ResponseWriter, b []byte)
JSONResponse sets the Content-Type header to application/json and returns the response.
func RankHandler ¶
func RankHandler(rw http.ResponseWriter, r *http.Request)
RankHandler returns the average rank and other information about a text
func SplitHandler ¶
func SplitHandler(rw http.ResponseWriter, r *http.Request)
SplitHandler returns a tokenized version of the Chinese text supplied to it.
func WordsHandler ¶
func WordsHandler(rw http.ResponseWriter, r *http.Request)
WordsHandler returns a tokenized version of the Chinese text supplied to it (like SplitHandler), along with information on these words, like individual rank
Types ¶
type AnalyzeResponse ¶
type Operations ¶
var Ops *Operations
func NewOperations ¶
func NewOperations(server string, password string) (o *Operations)
func (*Operations) GetRank ¶
func (o *Operations) GetRank(s string) (rank int)
GetRank returns the rank of a key from the Redis key/value store.
func (*Operations) GetRanks ¶
func (o *Operations) GetRanks(words []string) (ranks []int)
GetRank returns the ranks of words from the Redis key/value store.
type RankResponse ¶
type RankResponse struct { Rank rank `json:"rank"` Words words `json:"words"` }
type SplitResponse ¶
type SplitResponse struct {
Text []string `json:"text"`
}
type WordsResponse ¶
Click to show internal directories.
Click to hide internal directories.