chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase
This commit is contained in:
parent
970e08c466
commit
1f7e365a4e
237 changed files with 1951 additions and 49413 deletions
|
|
@ -78,7 +78,7 @@ export class NaturalLanguageProcessor {
|
|||
}
|
||||
|
||||
// Use brain's embed method directly to avoid recursion
|
||||
const embedding = await (this.brain as any).embed(text)
|
||||
const embedding = await this.brain.embed(text)
|
||||
|
||||
// Cache the embedding
|
||||
this.embeddingCache.set(text, embedding)
|
||||
|
|
@ -1161,8 +1161,8 @@ export class NaturalLanguageProcessor {
|
|||
const extractor = new NeuralEntityExtractor(this.brain)
|
||||
|
||||
// Convert string types to NounTypes if provided
|
||||
const nounTypes = options?.types ?
|
||||
options.types.map(t => t as any) :
|
||||
const nounTypes = options?.types ?
|
||||
options.types.map(t => t as NounType) :
|
||||
undefined
|
||||
|
||||
// Extract using neural matching
|
||||
|
|
@ -1253,7 +1253,7 @@ export class NaturalLanguageProcessor {
|
|||
const confidence = this.calculateConfidence(extractedText, type)
|
||||
|
||||
if (confidence >= minConfidence) {
|
||||
const entity = {
|
||||
const entity: (typeof extracted)[number] = {
|
||||
text: extractedText,
|
||||
type,
|
||||
position: {
|
||||
|
|
@ -1264,7 +1264,7 @@ export class NaturalLanguageProcessor {
|
|||
}
|
||||
|
||||
if (options?.includeMetadata) {
|
||||
(entity as any).metadata = {
|
||||
entity.metadata = {
|
||||
pattern: pattern.source,
|
||||
contextBefore: text.substring(Math.max(0, match.index - 20), match.index),
|
||||
contextAfter: text.substring(match.index + match[0].length, Math.min(text.length, match.index + match[0].length + 20))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue