Class QuestionRegistry

java.lang.Object
org.ek9lang.assist.QuestionRegistry

public class QuestionRegistry extends Object
Central registry for all Q&A pairs. Provides lookup by ID and category-grouped listing. Precomputes BM25F index data (IDF values and average field lengths) at construction time for efficient query-time scoring. Populated from .ek9 resource files via Ek9QaFileLoader.
  • Field Details

  • Constructor Details

  • Method Details

    • createDefault

      public static QuestionRegistry createDefault()
      Create a registry from all .ek9 QA resource files.
    • getAll

      public List<QuestionAndAnswer> getAll()
    • getByCategory

      public Map<String, List<QuestionAndAnswer>> getByCategory()
    • getForCategory

      public List<QuestionAndAnswer> getForCategory(String category)
    • getById

      public Optional<QuestionAndAnswer> getById(int id)
    • size

      public int size()
    • getIdfMap

      public Map<String,Double> getIdfMap()
      Precomputed IDF (inverse document frequency) values for all tokens in the corpus. Uses BM25-style IDF: log(1 + (N - df + 0.5) / (df + 0.5)). Higher IDF means the token is rarer and more discriminating.
    • getAvgFieldLengths

      public double[] getAvgFieldLengths()
      Average token count per BM25F field across the corpus. Field order: keywords, question text, alternates, answer text, migration context.