WSD Analysis Queries

SELECT b.ct_o, b.ct_a, (0.0+b.ct_a)/(0.0+b.ct_o) AS certainty
FROM (SELECT a.ct AS ct_o, (SELECT COUNT(*)
FROM wsd_word_assignments
WHERE c_id=a.c_id AND s_id=a.s_id AND w_id=a.w_id) AS ct_a
FROM (SELECT c_id, s_id, w_id, COUNT(*) AS ct
FROM wsd_word_options
GROUP BY c_id, s_id, w_id) a) b
SELECT (0.0+d.unambiguous)/(SELECT COUNT(*)
FROM wsd_sentences)
FROM (SELECT COUNT(*) AS unambiguous
FROM (SELECT b.ct_o, b.ct_a, (0.0+b.ct_a)/(0.0+b.ct_o) AS certainty
FROM (SELECT a.ct AS ct_o, (SELECT COUNT(*)
FROM wsd_word_assignments
WHERE c_id=a.c_id AND s_id=a.s_id AND w_id=a.w_id) AS ct_a
FROM (SELECT c_id, s_id, w_id, COUNT(*) AS ct
FROM wsd_word_options
GROUP BY c_id, s_id, w_id) a) b) c
WHERE c.certainty=1) d
SELECT SUM(c.exp)/COUNT(*)
FROM (SELECT (0.0+ct_a)/(0.0+ct_o) AS exp
FROM (SELECT a.ct AS ct_o, (SELECT COUNT(*)
FROM wsd_word_assignments
WHERE c_id=a.c_id AND s_id=a.s_id AND w_id=a.w_id) AS ct_a
FROM (SELECT c_id, s_id, w_id, COUNT(*) AS ct
FROM wsd_word_options
GROUP BY c_id, s_id, w_id) a) b) c