whatlanggo
1.0.0
GOの自然言語検出。
インストール:
go get -u github.com/abadojack/whatlanggo簡単な使用例:
package main
import (
"fmt"
"github.com/abadojack/whatlanggo"
)
func main () {
info := whatlanggo . Detect ( "Foje funkcias kaj foje ne funkcias" )
fmt . Println ( "Language:" , info . Lang . String (), " Script:" , whatlanggo . Scripts [ info . Script ], " Confidence: " , info . Confidence )
} package main
import (
"fmt"
"github.com/abadojack/whatlanggo"
)
func main () {
//Blacklist
options := whatlanggo. Options {
Blacklist : map [whatlanggo. Lang ] bool {
whatlanggo . Ydd : true ,
},
}
info := whatlanggo . DetectWithOptions ( "האקדמיה ללשון העברית" , options )
fmt . Println ( "Language:" , info . Lang . String (), "Script:" , whatlanggo . Scripts [ info . Script ])
//Whitelist
options1 := whatlanggo. Options {
Whitelist : map [whatlanggo. Lang ] bool {
whatlanggo . Epo : true ,
whatlanggo . Ukr : true ,
},
}
info = whatlanggo . DetectWithOptions ( "Mi ne scias" , options1 )
fmt . Println ( "Language:" , info . Lang . String (), " Script:" , whatlanggo . Scripts [ info . Script ])
}詳細については、ドキュメントを確認してください。
1.8以降に移動します
アルゴリズムは、N-Gramsの特定のケースであるTrigram言語モデルに基づいています。このアイデアを理解するには、元のWhitepaper CavnarとTrenkle '94:N-Gramベースのテキスト分類 'を確認してください。
これは、次の要因に基づいています。
rateと呼ばれます。したがって、しきい値関数を備えた2D空間として提示することができ、「信頼性の高い」および「信頼性のない」領域に分割されます。この機能は双曲線であり、次のように見えます。
詳細については、ブログ記事を確認してくださいRust Whatlang Library and Natural Language Identification Algorithmsの紹介をご覧ください。
mit
Whatlanggoは、Titus WormerによるFranc(JavaScript、MIT)の派生物です。
アイデアとアルゴリズムを手に入れた場所からWhatlang-rsを作成してくれたGreyblake(Potapov Sergey)に感謝します。