Skip to main content
. 2025 Sep 16;27(9):961. doi: 10.3390/e27090961
Algorithm 1 SE-KIA (offline component)
  •   1:

    Input: Query logs Q, search corpus C, co-occurrence threshold τ=10, search method Search(keywords, C) that returns an ordered list of documents ranked by relevance

  •   2:

    Output: Keyword co-occurrence word graph G=(V,E)

  •   3:

    Step 1: Data Extraction

  •   4:

    Parse Q to extract all queries containing exactly two keywords

  •   5:

    Filter out pairs with frequency f(A,B)>=τ, obtaining set P={(A,B)}

  •   6:

    Step 2: Posteriori Search Result Retrieval

  •   7:

    for each (A,B)P do

  •   8:

       YSearch(A&B,C)

  •   9:

       YASearch(A,C)

  • 10:

       YBSearch(B,C)

  • 11:

    end for

  • 12:

    Step 3: Semantic Entropy Calculation

  • 13:

    for each (A,B)P do

  • 14:

       Compute intersections:

  • 15:

       YYA={ZA1,ZA2,,ZAn}

  • 16:

       YYB={ZB1,ZB2,,ZBm}

  • 17:

       Calculate occurrence counts:

  • 18:

       tA(z) number of documents zZA in YA

  • 19:

       tB(z) number of documents zZB in YB

  • 20:

       Compute associated probabilities:

  • 21:

       pYA|Y(z)=tA(z)zZAtA(z)

  • 22:

       pYB|Y(z)=tB(z)zZBtB(z)

  • 23:

       Compute semantic entropy:

  • 24:

       S(YA,Y)=zZApYA|Y(z)logpYA|Y(z)

  • 25:

       S(YB,Y)=zZBpYB|Y(z)logpYB|Y(z)

  • 26:

    end for

  • 27:

    Step 4: Relative importance determination

  • 28:

    for each (A,B)P do

  • 29:

       if S(YA,Y)<S(YB,Y) then

  • 30:

          wAB1

  • 31:

        else if S(YA,Y)>S(YB,Y) then

  • 32:

          wAB1

  • 33:

       else

  • 34:

          wAB0

  • 35:

       end if

  • 36:

    end for

  • 37:

    Step 5: Graph Construction

  • 38:

    Initialize G=(V,E) where V, E

  • 39:

    for each (A,B)P do

  • 40:

       VV{A,B}

  • 41:

       EE{(A,B,wAB)}

  • 42:

    end for

  • 43:

    return G=(V,E)