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:

       Y←Search(A&B,C)

  •   9:

       YA←Search(A,C)

  • 10:

       YB←Search(B,C)

  • 11:

    end for

  • 12:

    Step 3: Semantic Entropy Calculation

  • 13:

    for each (A,B)∈P do

  • 14:

       Compute intersections:

  • 15:

       Y∩YA={ZA1,ZA2,…,ZAn}

  • 16:

       Y∩YB={ZB1,ZB2,…,ZBm}

  • 17:

       Calculate occurrence counts:

  • 18:

       tA(z)← number of documents z∈ZA in YA

  • 19:

       tB(z)← number of documents z∈ZB in YB

  • 20:

       Compute associated probabilities:

  • 21:

       pYA|Y(z)=tA(z)∑z∈ZAtA(z)

  • 22:

       pYB|Y(z)=tB(z)∑z∈ZBtB(z)

  • 23:

       Compute semantic entropy:

  • 24:

       S(YA,Y)=−∑z∈ZApYA|Y(z)logpYA|Y(z)

  • 25:

       S(YB,Y)=−∑z∈ZBpYB|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:

          wAB←1

  • 31:

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

  • 32:

          wAB←−1

  • 33:

       else

  • 34:

          wAB←0

  • 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:

       V←V∪{A,B}

  • 41:

       E←E∪{(A,B,wAB)}

  • 42:

    end for

  • 43:

    return G=(V,E)