MCPcopy Create free account
hub / github.com/github/docs / analyzeVersion

Function analyzeVersion

script/search/analyze-text.js:132–152  ·  view source on GitHub ↗
(client, texts, indexName, verbose = false)

Source from the content-addressed store, hash-verified

130 return parsed.toString()
131}
132async function analyzeVersion(client, texts, indexName, verbose = false) {
133 for (const text of texts) {
134 console.log(`RAW TEXT: 〝${chalk.italic(text)}〞`)
135 for (const analyzer of ['text_analyzer_explicit', 'text_analyzer', 'standard']) {
136 console.log('ANALYZER:', chalk.bold(analyzer))
137 const response = await client.indices.analyze({
138 index: indexName,
139 body: { analyzer, text },
140 })
141 if (response.statusCode !== 200) {
142 console.warn(response)
143 throw new Error(`${response.statusCode} on ${indexName}`)
144 }
145 const {
146 body: { tokens },
147 } = response
148 const tokenWords = tokens.map((token) => token.token)
149 console.log(tokenWords)
150 }
151 }
152}

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected