feat: initialize project structure with SQLite database, crawler framework, and LLM-based JD analysis integration
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package filter
|
||||
|
||||
import "context"
|
||||
|
||||
type FilterResult struct {
|
||||
Keep bool
|
||||
Score float64
|
||||
Reason string
|
||||
}
|
||||
|
||||
type JobFilter interface {
|
||||
Name() string
|
||||
Process(ctx context.Context, title, rawContent string) (FilterResult, error)
|
||||
}
|
||||
|
||||
type FilterPipeline struct {
|
||||
filters []JobFilter
|
||||
}
|
||||
|
||||
func NewPipeline(filters ...JobFilter) *FilterPipeline {
|
||||
return &FilterPipeline{filters: filters}
|
||||
}
|
||||
|
||||
func (p *FilterPipeline) Execute(ctx context.Context, title, rawContent string) (bool, float64) {
|
||||
var totalScore float64
|
||||
for _, f := range p.filters {
|
||||
res, err := f.Process(ctx, title, rawContent)
|
||||
if err != nil || !res.Keep {
|
||||
return false, 0
|
||||
}
|
||||
totalScore += res.Score
|
||||
}
|
||||
return true, totalScore
|
||||
}
|
||||
Reference in New Issue
Block a user