nlp

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2022 License: MIT Imports: 5 Imported by: 0

README

nlp 分词工具

工具加载

import (
	"github.com/cnlesscode/gotool/nlp"
)

使用演示

package main
import (
	"fmt"
	"github.com/cnlesscode/gotool/nlp"
)

func main() {
	words := nlp.Cut("我爱我的祖国")
	fmt.Printf("words: %v\n", words)
	words2 := nlp.Cut("坚持努力坚持执着")
	fmt.Printf("words: %v\n", words2)
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NPLNotWordsString string = ""

Functions

func CutAndSave

func CutAndSave(content string, db *gorm.DB, tableName string, mid int)

分词并保存到数据库

func SearchKwd

func SearchKwd(slice []NLPKwd, str string) int

Types

type KeywordsForDB

type KeywordsForDB struct {
	Id    int    `gorm:"column:id;primaryKey"`
	Word  string `gorm:"column:word"`
	Mid   int    `gorm:"column:mid"`
	Score int    `gorm:"column:score"`
}

type NLPKwd

type NLPKwd struct {
	KeyWord string
	Count   int
}

func Cut

func Cut(content string) []NLPKwd

分词

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL