mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-25 09:53:29 +08:00
Port PR14140 and PR16881 to GO (#17102)
### Summary Port https://github.com/infiniflow/ragflow/pull/14140/ https://github.com/infiniflow/ragflow/pull/16881
This commit is contained in:
@@ -96,6 +96,17 @@ func (a *Analyzer) SetEnablePosition(enablePosition bool) {
|
||||
C.RAGAnalyzer_SetEnablePosition(a.handle, C.bool(enablePosition))
|
||||
}
|
||||
|
||||
// SetLanguage configures the Snowball stemmer for the given language (e.g. "English", "Dutch").
|
||||
// Falls back to the English Porter stemmer for unmapped languages.
|
||||
func (a *Analyzer) SetLanguage(language string) {
|
||||
if a.handle == nil {
|
||||
return
|
||||
}
|
||||
cLang := C.CString(language)
|
||||
defer C.free(unsafe.Pointer(cLang))
|
||||
C.RAGAnalyzer_SetLanguage(a.handle, cLang)
|
||||
}
|
||||
|
||||
// Analyze analyzes the input text and returns all tokens
|
||||
func (a *Analyzer) Analyze(text string) ([]Token, error) {
|
||||
if a.handle == nil {
|
||||
|
||||
Reference in New Issue
Block a user