github.com/lazin/go-ngram@v0.0.0-20160527144230-80eaf16ac4eb/README.md (about)

     1  go-ngram [![Build Status](https://travis-ci.org/Lazin/go-ngram.svg)](https://travis-ci.org/Lazin/go-ngram)
     2  ========
     3  
     4  N-gram index for Go.
     5  
     6  ## Key features
     7  
     8  * Unicode support.
     9  * Append only. Data can't be deleted from index.
    10  * GC friendly (all strings are pooled and compressed)
    11  * Application agnostic (there is no notion of document or something that user needs to implement)
    12   
    13  
    14  ## Usage
    15  
    16  ```go
    17  index, err := ngram.NewNGramIndex(ngram.SetN(3))
    18  tokenId, err := index.Add("hello") 
    19  str, err := index.GetString(tokenId)  // str == "hello"
    20  resultsList, err := index.Search("world")
    21  ```
    22  
    23  ## TODO:
    24  
    25  * Smoothing functions (Laplace etc)
    26  
    27  [![GoDoc](https://godoc.org/github.com/Lazin/go-ngram?status.png)](https://godoc.org/github.com/Lazin/go-ngram)
    28  
    29  [![docs examples](https://sourcegraph.com/api/repos/github.com/Lazin/go-ngram/.badges/docs-examples.png)](https://sourcegraph.com/github.com/Lazin/go-ngram)
    30  
    31  [![library users](https://sourcegraph.com/api/repos/github.com/Lazin/go-ngram/.badges/library-users.png)](https://sourcegraph.com/github.com/Lazin/go-ngram)