Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nuance/go-nlp
Utilities for working with discrete probability distributions and other tools useful for doing NLP work
https://github.com/nuance/go-nlp
Last synced: 3 months ago
JSON representation
Utilities for working with discrete probability distributions and other tools useful for doing NLP work
- Host: GitHub
- URL: https://github.com/nuance/go-nlp
- Owner: nuance
- Archived: true
- Created: 2011-05-02T06:43:36.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2011-11-15T17:49:45.000Z (over 12 years ago)
- Last Synced: 2024-01-17T09:48:41.688Z (5 months ago)
- Language: Go
- Homepage:
- Size: 119 KB
- Stars: 95
- Watchers: 8
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Lists
- awesome-go-cn - go-nlp
- awesome-go-zh - go-nlp
- awesome-go - go-nlp
- fucking-awesome-go - :octocat: go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. :star: 48 :fork_and_knife: 10 (Natural Language Processing / Advanced Console UIs)
- awesome-go - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Uncategorized)
- awesome-go-projects - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Uncategorized)
- awesome-go - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Advanced Console UIs)
- awesome-go - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Advanced Console UIs)
- awesome-go-with-framework - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Strings)
- awesome-go - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Advanced Console UIs)
- awesome-go - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Strings)
- awesome-go. - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Advanced Console UIs)
- awesome-go - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (<span id="自然语言处理-natural-language-processing">自然语言处理 Natural Language Processing</span> / <span id="高级控制台用户界面-advanced-console-uis">高级控制台用户界面 Advanced Console UIs</span>)
- awesome-go - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Uncategorized)
- awesome-Char - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Uncategorized)
- awesome-reader - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Strings)
- awesome-go - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Strings)
- awesome-go-cn - go-nlp
- go-awesome-cn-star - go-nlp
- awesome-go - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Advanced Console UIs)
- awesome-go-handwritten - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Advanced Console UIs)
- awesome-go2 - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Advanced Console UIs)
- awesome-go - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Uncategorized)
- awesome-go - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Strings)
- awesome-go - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Advanced Console UIs)
- awesome-go - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work. (Natural Language Processing / Uncategorized)
- awesome-go-cn - go-nlp
- awesome-go - go-nlp - Utilities for working with discrete probability distributions and other tools useful for doing NLP work - ★ 76 (Natural Language Processing)
README
GNLP
====A few structures for doing NLP analysis / experiments.
Basics
------* counter.Counter
A map-like data structure for representing discrete probability
distributions. Contains an underlying map of event -> probability
along with a probability for all other events. Supports some
element-wise mathematical operations with other counter.Counter
objects.```go
// Create a counter with 0 probability for unknown events (and with ""
// corresponding to the unknown event)
balls := counter.New(0.0)
// Add some observations
balls.Incr("blue")
balls.Incr("blue")
balls.Incr("red")// Normalize into a discrete distribution
balls.Normalize()// blue => 0.666666
balls.Get("blue")// purple => 0.0
balls.Get("purple")preference = counter.New(0.0)
preference.Set("red", 2.0)
preference.Set("blue", 1.0)
preference.Normalize()expected_with_preference = counter.Multiply(balls, preference)
expected_with_preference.Normalize()// blue => 0.5
expected_with_preference.Get("blue")
// red => 0.5
expected_with_preference.Get("red")// You can also use log probabilities
balls.LogNormalize()
preferences.LogNormalize()// And do in-place operations
balls.Add(preferences)// Log-normalize expects counters with positive counts, so
// exponentiate-then-normalize
balls.Exp()
balls.LogNormalize()// blue => -1 (== lg(0.5))
balls.Get("blue")
```* frozencounter.Counter
Similar to counter.Counters, but with a fixed set of keys and no
default value. Represented under the hood as an array of doubles (with
order fixed according to the set of keys). Supports element-wise math
operations with other frozencounter.Counters that share the same set
of keys. Some mathematical operations are accelerated by the BLAS
library.```go
fBalls := frozencounter.Freeze(balls)
fPrefs := frozencounter.Freeze(preference)fExpectedWithPreference := frozencounter.Multiply(fBalls, fPrefs)
```