Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Cgo binding for Snowball C library

License

NotificationsYou must be signed in to change notification settings

goodsign/snowball

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snowball stemmer port (cgo wrapper) for Go. Provides word stem extraction functionality. For more detailed info seehttp://snowball.tartarus.org/

Installing

go get github.com/goodsign/snowballgo test github.com/goodsign/snowball (Must PASS)

Done! Use it in your go files. (import 'github.com/goodsign/snowball')

Usage

stemmer,err:=NewWordStemmer(algorithm,encoding)ifnil!=err {/*...handle error...*/  }deferstemmer.Close()wordStem,err:=stemmer.Stem(word)ifnil!=err {/*...handle error...*/  }/* Use wordStem */

Usage notes

According to Snowball documentation:

Creating a stemmer is a relatively expensive operation - the expectedusage pattern is that a new stemmer is created when needed, usedto stem many words, and deleted after some time.

Algorithms & encodings

Filemodules.txt contains all the main algorithms for each language, in UTF-8, and also withthe most commonly used encoding.

Language        Encodings               Algorithmsdanish          UTF_8,ISO_8859_1        danish,da,dandutch           UTF_8,ISO_8859_1        dutch,nl,dut,nldenglish         UTF_8,ISO_8859_1        english,en,engfinnish         UTF_8,ISO_8859_1        finnish,fi,finfrench          UTF_8,ISO_8859_1        french,fr,fre,fragerman          UTF_8,ISO_8859_1        german,de,ger,deuhungarian       UTF_8,ISO_8859_1        hungarian,hu,hunitalian         UTF_8,ISO_8859_1        italian,it,itanorwegian       UTF_8,ISO_8859_1        norwegian,no,norportuguese      UTF_8,ISO_8859_1        portuguese,pt,porromanian        UTF_8,ISO_8859_2        romanian,ro,rum,ronrussian         UTF_8,KOI8_R            russian,ru,russpanish         UTF_8,ISO_8859_1        spanish,es,esl,spaswedish         UTF_8,ISO_8859_1        swedish,sv,sweturkish         UTF_8                   turkish,tr,tur

Thread-safety

The original Snowball documentation says:

Stemmers are re-entrant, but not threadsafe.  In other words, ifyou wish to access the same stemmer object from multiple threads,you must ensure that all access is protected by a mutex or similardevice.

Thus this Go wrapper usessync.Mutex for each stem operation, so it is thread safe.

Snowball Licence

The Snowball library is released under theBSD Licence

Licence

The goodsign/snowball binding is released under theBSD Licence

LICENCE file

About

Cgo binding for Snowball C library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp