diff --git a/README.md b/README.md index 0e9fe2e..00a7b19 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,6 @@ -<<<<<<< HEAD -# prose [![Build Status](https://travis-ci.org/jdkato/prose.svg?branch=master)](https://travis-ci.org/jdkato/prose) [![Build status](https://ci.appveyor.com/api/projects/status/24bepq85nnnk4scr/branch/master?svg=true)](https://ci.appveyor.com/project/jdkato/prose/branch/master) [![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://godoc.org/github.com/jdkato/prose) [![Coverage Status](https://coveralls.io/repos/github/jdkato/prose/badge.svg?branch=master)](https://coveralls.io/github/jdkato/prose?branch=master) [![Go Report Card](https://goreportcard.com/badge/github.com/jdkato/prose)](https://goreportcard.com/report/github.com/jdkato/prose) [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/avelino/awesome-go#natural-language-processing) - - -`prose` is Go library for text (primarily English at the moment) processing that supports tokenization, part-of-speech tagging, named-entity extraction, and more. The library's functionality is split into subpackages designed for modular use. -======= # prose [![Build Status](https://travis-ci.org/jdkato/prose.svg?branch=master)](https://travis-ci.org/jdkato/prose) [![Build status](https://ci.appveyor.com/api/projects/status/24bepq85nnnk4scr?svg=true)](https://ci.appveyor.com/project/jdkato/prose) [![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://godoc.org/gopkg.in/jdkato/prose.v2) [![Coverage Status](https://coveralls.io/repos/github/jdkato/prose/badge.svg?branch=v2)](https://coveralls.io/github/jdkato/prose?branch=v2) [![Go Report Card](https://goreportcard.com/badge/github.com/jdkato/prose)](https://goreportcard.com/report/github.com/jdkato/prose) [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/avelino/awesome-go#natural-language-processing) `prose` is a natural language processing library (English only, at the moment) in *pure Go*. It supports tokenization, segmentation, part-of-speech tagging, and named-entity extraction. ->>>>>>> v2 You can can find a more detailed summary on the library's performance here: [Introducing `prose` v2.0.0: Bringing NLP *to Go*](https://medium.com/@errata.ai/introducing-prose-v2-0-0-bringing-nlp-to-go-a1f0c121e4a5). diff --git a/appveyor.yml b/appveyor.yml index 5edf771..04a1fd7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,7 @@ version: "{build}" os: Windows Server 2012 R2 clone_folder: c:\GOPATH\src\github.com\jdkato\prose +build: off environment: GOPATH: c:\GOPATH init: diff --git a/extract.go b/extract.go index 1d7d3aa..2e8bd32 100644 --- a/extract.go +++ b/extract.go @@ -492,11 +492,7 @@ func encode(corpus featureSet) *binaryMaxentClassifier { for _, fname := range featureOrder { fval := entry.features[fname] key := strings.Join([]string{fname, fval}, "-") - if _, ok := count[key]; ok { - count[key]++ - } else { - count[key] = 1 - } + count[key]++ entry := strings.Join([]string{fname, fval, label}, "-") if _, found := mapping[entry]; !found { mapping[entry] = len(mapping) diff --git a/tag.go b/tag.go index d1fb6d8..b67ee6b 100644 --- a/tag.go +++ b/tag.go @@ -313,11 +313,7 @@ func (m *averagedPerceptron) predict(features map[string]float64) string { continue } for label, weight := range weights { - if _, ok := scores[label]; ok { - scores[label] += value * weight - } else { - scores[label] = value * weight - } + scores[label] += value * weight } } return max(scores) @@ -360,11 +356,7 @@ func featurize(i int, ctx []string, w, p1, p2 string) map[string]float64 { func add(args []string, features map[string]float64) map[string]float64 { key := strings.Join(args, " ") - if _, ok := features[key]; ok { - features[key]++ - } else { - features[key] = 1 - } + features[key]++ return features }