MCPcopy Create free account
hub / github.com/atripati/ark / detectLanguage

Function detectLanguage

pkg/tools/github.go:725–752  ·  view source on GitHub ↗

detectLanguage extracts a programming language name from a natural language query.

(query string)

Source from the content-addressed store, hash-verified

723
724// detectLanguage extracts a programming language name from a natural language query.
725func detectLanguage(query string) string {
726 q := strings.ToLower(query)
727 languages := map[string]string{
728 "python": "python",
729 "javascript": "javascript",
730 "typescript": "typescript",
731 "go": "go",
732 "golang": "go",
733 "rust": "rust",
734 "java": "java",
735 "ruby": "ruby",
736 "c++": "cpp",
737 "cpp": "cpp",
738 "c#": "csharp",
739 "csharp": "csharp",
740 "php": "php",
741 "swift": "swift",
742 "kotlin": "kotlin",
743 "scala": "scala",
744 "elixir": "elixir",
745 }
746 for keyword, lang := range languages {
747 if strings.Contains(q, keyword) {
748 return lang
749 }
750 }
751 return ""
752}
753
754func simplifyRepoList(raw string) (string, error) {
755 var repos []map[string]interface{}

Callers 1

searchReposMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected