我的問題是有關在這裏Scraping an HTML table in Common Lisp?刮HTML中口齒不清
發現了另一個問題,我想從Common Lisp的網頁中提取數據。我目前正在使用drakma發送http請求,並且我正在嘗試使用chtml來提取我正在查找的數據。我試圖廢料的網頁爲http://erg.delph-in.net/logon,這裏是我的代碼
(defun send-request (sentence)
"sends sentence in an http request to logon for parsing, and recieves
back the webpage containing the MRS output"
(drakma:http-request "http://erg.delph-in.net/logon"
:method :post
:parameters `(("input" . ,sentence)
("task" . "Analyze")
("roots" . "sentences")
("output" . "mrs")
("exhaustivep" . "best")
("nresults" . "1"))))
這裏與
(defun get-mrs (sentence)
(let* (
(str (send-request sentence))
(document (chtml:parse str (cxml-stp:make-builder))))
(stp:filter-recursively (stp:of-name "mrsFeatureTop") document)))
我有麻煩的功能基本上所有我需要提取的數據是在HTML表格,但它太大,不能粘貼在這裏。在我的get-mrs函數中,我只是試圖獲取名稱爲mrsFeatureTop的標籤,但我不確定這是否正確,但由於出現錯誤:不是NCName的onclick。任何幫助刮桌子將不勝感激。謝謝。
感謝wvxvw,我同意很多網頁都是垃圾。我會嘗試你的建議。你以前幫過我很多其他的問題,我爲此感謝你:)。 – turingcomplete