github.com/balzaczyy/golucene@v0.0.0-20151210033525-d0be9ee89713/analysis/util/stopword.go (about)

     1  package util
     2  
     3  import (
     4  	. "github.com/balzaczyy/golucene/core/analysis"
     5  )
     6  
     7  // util/StopwordAnalyzerBase.java
     8  
     9  /* Base class for Analyzers that need to make use of stopword sets. */
    10  type StopwordAnalyzerBase struct {
    11  	*AnalyzerImpl
    12  	stopwords map[string]bool
    13  }
    14  
    15  func NewStopwordAnalyzerBaseWithStopWords(stopwords map[string]bool) *StopwordAnalyzerBase {
    16  	ans := new(StopwordAnalyzerBase)
    17  	ans.AnalyzerImpl = NewAnalyzer()
    18  	ans.stopwords = make(map[string]bool)
    19  	if stopwords != nil {
    20  		for k, v := range stopwords {
    21  			ans.stopwords[k] = v
    22  		}
    23  	}
    24  	return ans
    25  }