Remove unused code
This commit is contained in:
parent
903240dd18
commit
badbe5e92f
@ -30,11 +30,8 @@ func FetchPageInfo(bm entity.Bookmark) entity.PageInfo {
|
|||||||
c.OnResponse(func(r *colly.Response) {
|
c.OnResponse(func(r *colly.Response) {
|
||||||
info.StatusCode = r.StatusCode
|
info.StatusCode = r.StatusCode
|
||||||
info.Size = len(r.Body)
|
info.Size = len(r.Body)
|
||||||
// log.Printf("content type for %s: %s (%d)", r.Request.URL.String(), r.Headers.Get("Content-Type"), info.Size)
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Before making a request print "Visiting ..."
|
|
||||||
c.OnRequest(func(r *colly.Request) {
|
c.OnRequest(func(r *colly.Request) {
|
||||||
// log.Println("Visiting", r.URL.String())
|
// log.Println("Visiting", r.URL.String())
|
||||||
})
|
})
|
||||||
@ -46,51 +43,3 @@ func FetchPageInfo(bm entity.Bookmark) entity.PageInfo {
|
|||||||
c.Visit(url)
|
c.Visit(url)
|
||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
// func Words(bm *entity.Bookmark) []string {
|
|
||||||
// words := []string{}
|
|
||||||
|
|
||||||
// words = append(words, StringToStemmedSearchWords(bm.Info.RawText)...)
|
|
||||||
// words = append(words, StringToStemmedSearchWords(bm.Info.Title)...)
|
|
||||||
// words = append(words, StringToStemmedSearchWords(bm.URL)...)
|
|
||||||
// return words
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // StringToStemmedSearchWords returns a list of stemmed words with stop words
|
|
||||||
// // removed.
|
|
||||||
// func StringToStemmedSearchWords(s string) []string {
|
|
||||||
// words := []string{}
|
|
||||||
|
|
||||||
// words = append(words, stemmerFilter(stopwordFilter(tokenize(s)))...)
|
|
||||||
// return words
|
|
||||||
// }
|
|
||||||
|
|
||||||
// func tokenize(text string) []string {
|
|
||||||
// return strings.FieldsFunc(text, func(r rune) bool {
|
|
||||||
// // Split on any character that is not a letter or a number.
|
|
||||||
// return !unicode.IsLetter(r) && !unicode.IsNumber(r)
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// func stemmerFilter(tokens []string) []string {
|
|
||||||
// r := make([]string, len(tokens))
|
|
||||||
// for i, token := range tokens {
|
|
||||||
// r[i] = snowballeng.Stem(token, false)
|
|
||||||
// }
|
|
||||||
// return r
|
|
||||||
// }
|
|
||||||
|
|
||||||
// var stopwords = map[string]struct{}{ // I wish Go had built-in sets.
|
|
||||||
// "a": {}, "and": {}, "be": {}, "have": {}, "i": {},
|
|
||||||
// "in": {}, "of": {}, "that": {}, "the": {}, "to": {},
|
|
||||||
// }
|
|
||||||
|
|
||||||
// func stopwordFilter(tokens []string) []string {
|
|
||||||
// r := make([]string, 0, len(tokens))
|
|
||||||
// for _, token := range tokens {
|
|
||||||
// if _, ok := stopwords[token]; !ok {
|
|
||||||
// r = append(r, token)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return r
|
|
||||||
// }
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user