summaryrefslogtreecommitdiff
path: root/analyzer/analyzer.go
diff options
context:
space:
mode:
authoralex <[email protected]>2026-07-28 17:37:06 +0200
committeralex <[email protected]>2026-07-28 17:37:06 +0200
commitc91c3afd8700138f8eb8a25a4ae422c2c9e46cea (patch)
treefd9b5ea4f3b821581b2ceb4e7fa8afc1a84c0eeb /analyzer/analyzer.go
parent5858d34b8ab573e18a4f6ddc5ee962b24ea269dc (diff)
downloadsearch-engine-c91c3afd8700138f8eb8a25a4ae422c2c9e46cea.tar.xz
search-engine-c91c3afd8700138f8eb8a25a4ae422c2c9e46cea.zip
refactored entire code base to be in the package core so i can later implement interfaces to interact with the engine
Diffstat (limited to 'analyzer/analyzer.go')
-rw-r--r--analyzer/analyzer.go38
1 files changed, 0 insertions, 38 deletions
diff --git a/analyzer/analyzer.go b/analyzer/analyzer.go
deleted file mode 100644
index 2bb8f96..0000000
--- a/analyzer/analyzer.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package analyzer
-
-import (
- "strings"
- "unicode"
-)
-
-var stopWords = map[string]struct{}{
- "the": {}, "a": {}, "an": {}, "and": {}, "or": {}, "but": {},
- "is": {}, "are": {}, "was": {}, "were": {}, "in": {}, "on": {},
- "at": {}, "to": {}, "from": {}, "by": {}, "of": {},
-}
-
-func ProcessText(text string) []string {
- text = strings.ToLower(text)
- text = SanitizeText(text)
- tokens := strings.Fields(text)
- var cleanTokens []string
- for _, token := range tokens {
- _, exists := stopWords[token]
- if !exists {
- cleanTokens = append(cleanTokens, token)
- }
- }
-
- return cleanTokens
-}
-
-func SanitizeText(s string) string {
- var builder strings.Builder
-
- for _, char := range s {
- if unicode.IsLetter(char) || unicode.IsNumber(char) || unicode.IsSpace(char) {
- builder.WriteRune(char)
- }
- }
- return builder.String()
-}