package com.iqser.red.service.persistence.management.v1.processor.service;

import java.util.HashSet;
import java.util.Locale;
import java.util.Set;

import jakarta.annotation.PostConstruct;

import org.springframework.stereotype.Service;

import com.iqser.red.service.persistence.management.v1.processor.utils.ResourceLoader;

import lombok.RequiredArgsConstructor;

@Service
@RequiredArgsConstructor
public class StopwordService {

    Set<String> stopwords = new HashSet<>();


    @PostConstruct
    public void init() {

        stopwords = ResourceLoader.load("files/stopwords.txt");
    }


    public boolean isStopword(String word) {

        return stopwords.contains(word.toLowerCase(Locale.ROOT));
    }

}
