Documentation
¶
Index ¶
- type JscodeStreamParser
- func (p *JscodeStreamParser) GetSupportedTypes() []string
- func (p *JscodeStreamParser) Parse(ctx context.Context, content []byte, metadata map[string]any) (*core.Document, error)
- func (p *JscodeStreamParser) ParseStream(ctx context.Context, r io.Reader, metadata map[string]any) (<-chan *core.Document, error)
- func (p *JscodeStreamParser) SetChunkOverlap(overlap int)
- func (p *JscodeStreamParser) SetChunkSize(size int)
- func (p *JscodeStreamParser) SetExtractClasses(extract bool)
- func (p *JscodeStreamParser) SetExtractComments(extract bool)
- func (p *JscodeStreamParser) SetExtractFunctions(extract bool)
- func (p *JscodeStreamParser) Supports(contentType string) bool
- type Parser
- func (p *Parser) Parse(ctx context.Context, r io.Reader) ([]core.Chunk, error)
- func (p *Parser) ParseWithCallback(ctx context.Context, r io.Reader, callback func(core.Chunk) error) error
- func (p *Parser) SetChunkOverlap(overlap int)
- func (p *Parser) SetChunkSize(size int)
- func (p *Parser) SetExtractClasses(extract bool)
- func (p *Parser) SetExtractComments(extract bool)
- func (p *Parser) SetExtractFunctions(extract bool)
- func (p *Parser) SupportedFormats() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JscodeStreamParser ¶
type JscodeStreamParser struct {
// contains filtered or unexported fields
}
func DefaultJscodeStreamParser ¶ added in v1.1.3
func DefaultJscodeStreamParser() *JscodeStreamParser
DefaultJscodeStreamParser creates a new JavaScript code stream parser
func (*JscodeStreamParser) GetSupportedTypes ¶
func (p *JscodeStreamParser) GetSupportedTypes() []string
GetSupportedTypes returns the supported file formats
func (*JscodeStreamParser) Parse ¶
func (p *JscodeStreamParser) Parse(ctx context.Context, content []byte, metadata map[string]any) (*core.Document, error)
Parse implements core.Parser interface.
func (*JscodeStreamParser) ParseStream ¶
func (p *JscodeStreamParser) ParseStream(ctx context.Context, r io.Reader, metadata map[string]any) (<-chan *core.Document, error)
ParseStream implements the core.Parser interface
func (*JscodeStreamParser) SetChunkOverlap ¶
func (p *JscodeStreamParser) SetChunkOverlap(overlap int)
SetChunkOverlap sets the chunk overlap
func (*JscodeStreamParser) SetChunkSize ¶
func (p *JscodeStreamParser) SetChunkSize(size int)
SetChunkSize sets the chunk size
func (*JscodeStreamParser) SetExtractClasses ¶
func (p *JscodeStreamParser) SetExtractClasses(extract bool)
SetExtractClasses sets whether to extract classes
func (*JscodeStreamParser) SetExtractComments ¶
func (p *JscodeStreamParser) SetExtractComments(extract bool)
SetExtractComments sets whether to extract comments
func (*JscodeStreamParser) SetExtractFunctions ¶
func (p *JscodeStreamParser) SetExtractFunctions(extract bool)
SetExtractFunctions sets whether to extract functions
func (*JscodeStreamParser) Supports ¶
func (p *JscodeStreamParser) Supports(contentType string) bool
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser implements a JavaScript code parser
func DefaultParser ¶ added in v1.1.3
func DefaultParser() *Parser
DefaultParser creates a new JavaScript parser
func (*Parser) ParseWithCallback ¶
func (p *Parser) ParseWithCallback(ctx context.Context, r io.Reader, callback func(core.Chunk) error) error
ParseWithCallback parses JavaScript code and calls the callback for each chunk
func (*Parser) SetChunkOverlap ¶
SetChunkOverlap sets the chunk overlap
func (*Parser) SetChunkSize ¶
SetChunkSize sets the chunk size
func (*Parser) SetExtractClasses ¶
SetExtractClasses sets whether to extract classes
func (*Parser) SetExtractComments ¶
SetExtractComments sets whether to extract comments
func (*Parser) SetExtractFunctions ¶
SetExtractFunctions sets whether to extract functions