跳轉到內容

用模糊文本做滑鼠追蹤閱讀(MoTR)

無需眼動儀,通過模糊除滑鼠指標附近之外的文本來測量每個詞的閱讀時間,並把理解題保留到閱讀結束之後。

v2.15.0 新增

cursor_reveal 方案把條目的文本顯示為模糊狀態,只有滑鼠指標附近的詞是清晰的。讀者沿著每一行移動指標來閱讀文本,Potato 記錄指標的路徑,帶有時間戳,以及每個取樣時指標下的詞。研究可以從儲存的路徑得到每個詞的閱讀時間、對較早詞語的回視,以及總閱讀時間,實驗室裡不需要眼動儀。這個方案適合在網頁瀏覽器中執行的心理語言學閱讀研究,理解題可以等到讀者按下結束閱讀的按鈕之後再出現。

眼動追蹤是測量讀者注視每個詞多長時間的標準方法,而首次通過閱讀時間和回視這類眼動指標通常需要實驗室硬體。Wilcox、Ding、Sachan 和 Jäger(2024)提出的閱讀的滑鼠追蹤(MoTR)改用滑鼠來測量增量式閱讀。文本被模糊,只有滑鼠指標周圍的區域是清晰的,指標的路徑代替讀者的視線。Potato 的 cursor_reveal 方案實現了 MoTR 的顯示並存儲取樣,分析程式碼再根據取樣計算每個詞的指標。

配置

下面的配置把每個句子顯示為模糊狀態,並在每個句子之後問一個問題。label_requirement 在 Potato 儲存了一次閱讀之前一直阻止"下一個"按鈕:

yaml
annotation_task_name: "Read with the mouse"
task_dir: .
data_files:
  - data/passages.jsonl
item_properties:
  id_key: id
  text_key: text
output_annotation_dir: annotation_output/
export_annotation_format: jsonl
user_config:
  allow_all_users: true
 
annotation_schemes:
  - annotation_type: cursor_reveal
    name: reading
    description: "Move the mouse pointer along the sentence to read it"
    radius: 40
    blur: 4
    label_requirement:
      required: true
 
  - annotation_type: radio
    name: comprehension
    description: "How well did you understand the sentence?"
    labels: ["Fully", "Partly", "Not at all"]

方案讀取條目的 text_key 欄位,這裡是 text。data/passages.jsonl 的每一行是一個條目:

json
{"id": "s1", "text": "The black cat slept quietly on the kitchen windowsill all afternoon."}

選項

cursor_reveal 選項預設值含義
name必填方案名稱,也是閱讀記錄儲存時使用的鍵
description必填顯示在文本上方的說明
source_fieldtext_key 欄位儲存文本的條目欄位
radius40指標所在行上,距指標多遠(畫素)以內的詞保持清晰,從 5 到 400
blur4其他詞的模糊程度,單位為畫素,從 0 到 40
sample_ms20兩次記錄的指標取樣之間的最短間隔,單位為毫秒,從 5 到 1000
finish_buttonfalse用一個按鈕結束閱讀。true 把按鈕標為"I've finished reading",不超過 80 個字元的字串則設定按鈕文字
hide_after_finishtrue讀者按下結束按鈕後隱藏文本。該選項需要 finish_button
label_requirement無{required: true} 在儲存了閱讀記錄之前一直阻止"下一個"按鈕

Potato 在伺服器啟動時檢查這些選項,遇到超出上述範圍的值,或不帶 finish_button 的 hide_after_finish,會停止並給出資訊。

指標附近的清晰詞語

Potato 按空白字元把文本拆成詞,並把詞顯示為純文本。條目欄位中的 HTML 標記不會被渲染。指標所在行上、距指標 radius 畫素以內的詞是清晰的,其餘保持模糊。頁面上任何位置出現文本的清晰副本,都會讓讀者繞過模糊。因此,當方案讀取主文本欄位時,頁面會隱藏標註方案上方通常顯示的清晰文本副本。通過 source_field 讀取另一個欄位的方案,則讓主文本保持在螢幕上。

沒有結束按鈕時,Potato 在指標離開文本時儲存閱讀記錄,並在頁面因其他任何原因(例如"下一個"按鈕)儲存之前儲存。再次訪問某個條目時,新的取樣會追加到已儲存的取樣之後,新的時間戳接著最後一個已儲存的取樣繼續。

需要滑鼠或觸控板

這個方案需要滑鼠或觸控板。觸控式螢幕沒有懸停,在手機或平板上文本會一直保持模糊。請在招募文字中告知參與者,研究需要一臺帶滑鼠或觸控板的電腦。

閱讀之後的理解題

閱讀研究通常在段落讀完之後才顯示理解題,因為提前看到問題的讀者可以在段落中尋找答案。設定 finish_button 後,文本下方有一個按鈕來結束閱讀。只有讀者按下按鈕時,Potato 才儲存閱讀記錄,記錄隨之停止,文本也被隱藏,除非 hide_after_finish 為 false。因此,在閱讀方案上用 not_empty 運算子通過 display_logic 控制的問題,會一直隱藏到按下按鈕為止。

當每個條目有單獨的問題時,把問題文本放在條目欄位中,並在 instance_display 裡為該欄位設定同樣的規則。下面的配置在讀者讀完之後,把問題欄位和答案方案一起顯示出來:

yaml
annotation_task_name: "Mouse-tracking reading with comprehension questions"
task_dir: .
data_files:
  - data/passages.jsonl
item_properties:
  id_key: id
  text_key: text
output_annotation_dir: annotation_output/
export_annotation_format: jsonl
user_config:
  allow_all_users: true
 
instance_display:
  fields:
    - key: question
      type: text
      label: "Question"
      display_logic:
        show_when:
          - {schema: reading, operator: not_empty}
 
annotation_schemes:
  - annotation_type: cursor_reveal
    name: reading
    description: "Move the mouse pointer along the text to read it, then press the button."
    radius: 40
    blur: 4
    sample_ms: 20
    finish_button: "I've finished reading"
    label_requirement:
      required: true
 
  - annotation_type: radio
    name: comprehension
    description: "Answer the question about the passage."
    labels: ["Yes", "No"]
    display_logic:
      show_when:
        - {schema: reading, operator: not_empty}
    label_requirement:
      required: true

每個條目帶有段落和該段落的問題:

json
{"id": "p01", "text": "The council met on Tuesday evening, and after two hours of debate the vote on the new bus route was postponed until spring.", "question": "Was the vote on the bus route held on Tuesday?"}

instance_display 塊只列出 question 欄位,段落只出現在 cursor_reveal 方案內部,並且是模糊的。Potato 傳送的問題欄位是隱藏的,只在檢查規則之後才顯示問題。即便如此,問題文本仍然在頁面原始碼中,開啟 HTML 的讀者可以在那裡找到問題。在回答之後顯示欄位完整介紹了欄位規則。

規劃研究時,這個按鈕還有三種行為需要考慮:

  • 過早按下。 指標還沒有掃過文本時,讀者就按下按鈕,Potato 會請讀者先閱讀文本。
  • 回到已完成的條目。 已完成的條目在讀者回來時顯示問題,文本保持隱藏,Potato 不會向已儲存的閱讀記錄新增任何內容。
  • 未按按鈕就離開。 讀者在按下按鈕之前離開的閱讀記錄,Potato 不會儲存。對於帶結束按鈕的方案,伺服器也會拒絕沒有 "finished": true 的儲存閱讀記錄。

儲存的值

Potato 把每次閱讀儲存為方案名稱下的一個 JSON 字串,無論方案叫什麼,標籤鍵都是 reading:

json
{"reading": {"reading": "{\"words\": [\"The\", \"black\", \"cat\"], \"samples\": [[0, 0.02, 0.4, 0], [20, 0.05, 0.4, 0], [40, 0.11, 0.4, 1]], \"dwell\": [40, 20, 0]}"}}

這個 JSON 字串最多包含四個鍵:

  • words 按順序列出文本中的詞。
  • samples 每個取樣列出一項 [t, x, y, word]。t 是從文本顯示起算的毫秒數,x 和 y 是指標位置佔文本框的比例,word 是指標下的詞的索引,指標下沒有詞時為 -1。
  • dwell 給出指標在每個詞上停留的總時間,單位為毫秒。
  • finished 在讀者按下結束按鈕之後為 true,只出現在帶 finish_button 的方案上。

分析程式碼根據 samples 計算每個詞的首次通過閱讀時間、回視(較晚的取樣落在較早的詞上)和總閱讀時間,就像眼動研究處理注視點那樣。伺服器會拒絕時間順序錯亂的取樣、落在文本框之外的取樣,以及指向文本中不存在的詞的取樣,每個條目最多接受 50,000 個取樣。在預設的 sample_ms 20 下,50,000 個取樣覆蓋一個條目上超過 16 分鐘的指標移動。無論匯出格式如何,標註都會儲存到 annotation_output/<user>/user_state.json,jsonl 匯出以同樣的 JSON 字串攜帶閱讀記錄。

示例

Potato 的發行版包含一個兩句話的滑鼠追蹤示例。請在 Potato 檢出目錄的根目錄下啟動示例:

bash
potato start examples/advanced/mouse-tracking-reading/config.yaml -p 8000

示例詢問讀者對每個句子的理解程度,沒有結束按鈕。新增 finish_button 和上面配置中的 display_logic 規則,就能把問題保留到閱讀結束,然後把 data_files 指向你自己的段落。

延伸閱讀

有關實現細節,請參閱源文件。

參考文獻

  • Wilcox, E. G., Ding, C., Sachan, M., and Jäger, L. A. (2024). Mouse Tracking for Reading (MoTR): A new naturalistic incremental processing measurement tool. Journal of Memory and Language, 138, 104534. https://doi.org/10.1016/j.jml.2024.104534