Created
January 16, 2012 21:48
-
-
Save sorenmacbeth/1623205 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn generate-other-words [output-tap root date] | |
(let [others (generate-others root) | |
landings (landings-by-kw root) | |
sq (<- [?ngram ?other ?total-l ?total-pv ?total-b ?total-nv ?total-rv | |
?b-rate ?nv-rate ?rv-rate ?avg-depth] | |
(others ?ngram ?other ?kw) | |
(landings ?kw ?l ?pv ?b ?nv ?rv) | |
(ybot-stats ?l ?pv ?b ?nv ?rv :> | |
?total-l ?total-pv ?total-b ?total-nv ?total-rv | |
?b-rate ?nv-rate ?rv-rate ?avg-depth))] | |
(?<- "other words" output-tap [?json] | |
(sq ?ngram ?other ?l ?pv ?b ?nv ?rv ?br ?nvr ?rvr ?ad) | |
(write-json-map | |
[[:d :w :ow :l :pv :b :nV :rV :br :nVr :rVr :ad]] | |
(mongo-date date) ?ngram ?other ?l ?pv ?b ?nv ?rv ?br ?nvr ?rvr ?ad :> ?json)))) | |
(defn generate-other-words-url-stats [output-tap root date] | |
(let [others (generate-others root) | |
landings-by-kw-url (landings-by-kw-url root) | |
sq (<- [?ngram ?other !url ?total-l ?total-pv ?total-b ?total-nv ?total-rv | |
?b-rate ?nv-rate ?rv-rate ?avg-depth] | |
(others ?ngram ?other ?kw) | |
(landings-by-kw-url ?kw !url ?l ?pv ?b ?nv ?rv) | |
(ybot-stats ?l ?pv ?b ?nv ?rv :> | |
?total-l ?total-pv ?total-b ?total-nv ?total-rv | |
?b-rate ?nv-rate ?rv-rate ?avg-depth))] | |
(?<- "other words url stats" output-tap [?json] | |
(sq ?ngram ?other !url ?l ?pv ?b ?nv ?rv ?br ?nvr ?rvr ?ad) | |
(write-json-map | |
[[:d :w :ow :url :l :pv :b :nV :rV :br :nVr :rVr :ad]] | |
(mongo-date date) ?ngram ?other !url ?l ?pv ?b ?nv ?rv ?br ?nvr ?rvr ?ad :> ?json)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment