EyeTrackPy is a Python library for eye tracking analysis and prediction. The library consists of three main modules and includes example implementations.
This module includes a class for using two models to generate reading metrics (features) from text. Both models are based on two papers that we mention below. One of the main issues with these generative models is that they predict reading measures per token, and there tokens are different depending on the model they use. Our tool allows mapping these fixations to another selected model. Examples of how to perform this mapping can be found in the examples folder. It can integrate fixations_predictor_trained_1 and fixations_predictor_trained_2.
First, we perform an initial mapping of tokens to the words they belong to in each tokenizer with some properties of \textit{FastTokenizers} from the \textit{transformers} library. Then, we map words from one tokenizer to the words in the other and finally, we assume that the combination of the tokens that are mapped to a word in one tokenizer correspond to the tokens that are mapped to the word that is mapped to the initial word in the other tokenizer.
For each predictor, we reverse the method used to convert word-level features into token-level features but passing from tokens in the first one, to tokens in the second tokenizer. For example, if for the first \acrshort{et} features predictor models tokens $t_{1},t_{2}$ are mapped to tokens $t_{1},t_{2},t_{3}$ in another second tokenizer, the values sum for all the tokens in the first list and distribute them equally across all the tokens in the second list: being $t_{1}$ (1s TRT) and $t_{2}$ (2s TRT) each of $t_{1},t_{2},t_{3}$ are assigned a TRT of $(1+2)/3=1s$.
To be able to map between tokenizers you need to install:
pip install git+https://github.com/anlopez94/[email protected]
Token Mapping Example
Example of mapping Total Reading Time (TRT) between two different tokenizers:
| Field | Tokenizer 1 | Tokenizer 2 |
|---|---|---|
| Words | astrophotography | astrophotography |
| Tokens | ['_Astro', 'photo', 'graphy'] | ['Ċ', 'Ast', 'roph', 'ot', 'ography'] |
| Token indices | [22, 23, 24] | [23, 24, 25, 26, 271] |
| Token IDs | [15001, 17720, 16369] | [198, 62152, 22761, 354, 5814] |
| TRT (1) | [11.23, 11.49, 10.16] | [6.58, 6.58, 6.58, 6.58, 6.58] |
| TRT (2) | [24.53, 0, 0] | [24.53, 0, 0, 0, 0] |
Note:
@inproceedings{huang2023long,
title={Long-Range Language Modeling with Selective Cache},
author={Huang, Xuanli and Hollenstein, Nora},
booktitle={Findings of the 2023 Conference on Empirical Methods in Natural Language Processing},
pages={4838--4858},
year={2023}
}
If you use this model, please cite:
@inproceedings{li_torontocl_2021,
title = {{TorontoCL} at {CMCL} 2021 {Shared} {Task}: {RoBERTa} with {Multi}-{Stage} {Fine}-{Tuning} for {Eye}-{Tracking} {Prediction}},
author = {Li, Bai and Rudzicz, Frank},
booktitle = {Proceedings of the Workshop on Cognitive Modeling and Computational Linguistics},
year = {2021},
pages = {85--89},
publisher = {Association for Computational Linguistics},
doi = {10.18653/v1/2021.cmcl-1.9},
url = {https://aclanthology.org/2021.cmcl-1.9}
}
If you use this model, please cite:
@inproceedings{fosco_predicting_2020,
address = {Virtual Event USA},
title = {Predicting {Visual} {Importance} {Across} {Graphic} {Design} {Types}},
language = {en},
booktitle = {Proceedings of the 33rd {Annual} {ACM} {Symposium} on {User} {Interface} {Software} and {Technology}},
publisher = {ACM},
author = {Fosco, Camilo and Casser, Vincent and Bedi, Amish Kumar and O'Donovan, Peter and Hertzmann, Aaron and Bylinskii, Zoya},
month = oct,
year = {2020},
}
If you use this model, please cite:
@inproceedings{wang2024salchartqa,
title={SalChartQA: Question-driven Saliency on Information Visualisations},
author={Wang, Yao and Wang, Weitian and Abdelhafez, Abdullah and Elfares, Mayar and Hu, Zhiming and Bâce, Mihai and Bulling, Andreas},
booktitle={Proceedings of the 2024 CHI Conference on Human Factors in Computing Systems},
pages={1--15},
year={2024},
organization={ACM},
address={New York, NY, USA}
}
All model weights are automatically downloaded when you first use each model. The weights are:
.gitignore to prevent large files in the repositoryTools for processing and analyzing eye tracking data, including:
Visualization tools for:
The examples folder contains practical implementations demonstrating how to:
cd examples/data_generator
python main_predict_saliency_mdsem.py
cd examples/data_generator
python main_predict_fixations_words.py
cd examples/data_printer
python main_plot_scanpaths.py
cd examples/data_printer
python main_plot_saliency.py
cd examples/data_printer
python main_plot_fixations_words.py
pip install git+https://github.com/anlopez94/eyetrackpy.git
Requirements vary by module:
Core requirements:
Data Generator module:
pip install git+https://github.com/anlopez94/tokenizer_aligner.git
Data Processor & Printer modules:
EyeTrackPy is a Python library for eye tracking analysis and prediction. The library consists of three main modules and includes example implementations.
This module includes a class for using two models to generate reading metrics (features) from text. Both models are based on two papers that we mention below. One of the main issues with these generative models is that they predict reading measures per token, and there tokens are different depending on the model they use. Our tool allows mapping these fixations to another selected model. Examples of how to perform this mapping can be found in the examples folder. It can integrate fixations_predictor_trained_1 and fixations_predictor_trained_2.
First, we perform an initial mapping of tokens to the words they belong to in each tokenizer with some properties of \textit{FastTokenizers} from the \textit{transformers} library. Then, we map words from one tokenizer to the words in the other and finally, we assume that the combination of the tokens that are mapped to a word in one tokenizer correspond to the tokens that are mapped to the word that is mapped to the initial word in the other tokenizer.
For each predictor, we reverse the method used to convert word-level features into token-level features but passing from tokens in the first one, to tokens in the second tokenizer. For example, if for the first \acrshort{et} features predictor models tokens $t_{1},t_{2}$ are mapped to tokens $t_{1},t_{2},t_{3}$ in another second tokenizer, the values sum for all the tokens in the first list and distribute them equally across all the tokens in the second list: being $t_{1}$ (1s TRT) and $t_{2}$ (2s TRT) each of $t_{1},t_{2},t_{3}$ are assigned a TRT of $(1+2)/3=1s$.
To be able to map between tokenizers you need to install:
pip install git+https://github.com/anlopez94/[email protected]
Token Mapping Example
Example of mapping Total Reading Time (TRT) between two different tokenizers:
| Field | Tokenizer 1 | Tokenizer 2 |
|---|---|---|
| Words | astrophotography | astrophotography |
| Tokens | ['_Astro', 'photo', 'graphy'] | ['Ċ', 'Ast', 'roph', 'ot', 'ography'] |
| Token indices | [22, 23, 24] | [23, 24, 25, 26, 271] |
| Token IDs | [15001, 17720, 16369] | [198, 62152, 22761, 354, 5814] |
| TRT (1) | [11.23, 11.49, 10.16] | [6.58, 6.58, 6.58, 6.58, 6.58] |
| TRT (2) | [24.53, 0, 0] | [24.53, 0, 0, 0, 0] |
Note:
@inproceedings{huang2023long,
title={Long-Range Language Modeling with Selective Cache},
author={Huang, Xuanli and Hollenstein, Nora},
booktitle={Findings of the 2023 Conference on Empirical Methods in Natural Language Processing},
pages={4838--4858},
year={2023}
}
If you use this model, please cite:
@inproceedings{li_torontocl_2021,
title = {{TorontoCL} at {CMCL} 2021 {Shared} {Task}: {RoBERTa} with {Multi}-{Stage} {Fine}-{Tuning} for {Eye}-{Tracking} {Prediction}},
author = {Li, Bai and Rudzicz, Frank},
booktitle = {Proceedings of the Workshop on Cognitive Modeling and Computational Linguistics},
year = {2021},
pages = {85--89},
publisher = {Association for Computational Linguistics},
doi = {10.18653/v1/2021.cmcl-1.9},
url = {https://aclanthology.org/2021.cmcl-1.9}
}
If you use this model, please cite:
@inproceedings{fosco_predicting_2020,
address = {Virtual Event USA},
title = {Predicting {Visual} {Importance} {Across} {Graphic} {Design} {Types}},
language = {en},
booktitle = {Proceedings of the 33rd {Annual} {ACM} {Symposium} on {User} {Interface} {Software} and {Technology}},
publisher = {ACM},
author = {Fosco, Camilo and Casser, Vincent and Bedi, Amish Kumar and O'Donovan, Peter and Hertzmann, Aaron and Bylinskii, Zoya},
month = oct,
year = {2020},
}
If you use this model, please cite:
@inproceedings{wang2024salchartqa,
title={SalChartQA: Question-driven Saliency on Information Visualisations},
author={Wang, Yao and Wang, Weitian and Abdelhafez, Abdullah and Elfares, Mayar and Hu, Zhiming and Bâce, Mihai and Bulling, Andreas},
booktitle={Proceedings of the 2024 CHI Conference on Human Factors in Computing Systems},
pages={1--15},
year={2024},
organization={ACM},
address={New York, NY, USA}
}
All model weights are automatically downloaded when you first use each model. The weights are:
.gitignore to prevent large files in the repositoryTools for processing and analyzing eye tracking data, including:
Visualization tools for:
The examples folder contains practical implementations demonstrating how to:
cd examples/data_generator
python main_predict_saliency_mdsem.py
cd examples/data_generator
python main_predict_fixations_words.py
cd examples/data_printer
python main_plot_scanpaths.py
cd examples/data_printer
python main_plot_saliency.py
cd examples/data_printer
python main_plot_fixations_words.py
pip install git+https://github.com/anlopez94/eyetrackpy.git
Requirements vary by module:
Core requirements:
Data Generator module:
pip install git+https://github.com/anlopez94/tokenizer_aligner.git
Data Processor & Printer modules: