| import json | |
| import datasets | |
| _DESCRIPTION = "Neural data with intent context" | |
| _CITATION = "" | |
| _HOMEPAGE = "" | |
| _LICENSE = "" | |
| class NeuralData(datasets.GeneratorBasedBuilder): | |
| VERSION = datasets.Version("1.0.0") | |
| def _info(self): | |
| return datasets.DatasetInfo( | |
| description=_DESCRIPTION, | |
| features=datasets.Features({ | |
| "timestamp": datasets.Value("int64"), | |
| "session_time": datasets.Value("int64"), | |
| "channels": { | |
| f"channel_{i}": datasets.Value("float64") for i in range(32) | |
| }, | |
| "intent_context": { | |
| "mouse_movement": datasets.Sequence(datasets.Value("int64")), | |
| "keyboard_state": { | |
| "mouse": datasets.Value("bool") | |
| }, | |
| "camera_rotation": datasets.Sequence(datasets.Value("float64")), | |
| "active_targets": datasets.Value("int64") | |
| } | |
| }), | |
| supervised_keys=None, | |
| homepage=_HOMEPAGE, | |
| citation=_CITATION, | |
| license=_LICENSE, | |
| ) | |
| def _split_generators(self, dl_manager): | |
| return [ | |
| datasets.SplitGenerator( | |
| name=datasets.Split.TRAIN, | |
| gen_kwargs={"filepath": "neural_data.txt"} | |
| ) | |
| ] | |
| def _generate_examples(self, filepath): | |
| with open(filepath, "r") as f: | |
| for idx, line in enumerate(f): | |
| if line.strip(): | |
| data = json.loads(line) | |
| yield idx, data |