TEXT data reader

TEXT data reader reads files whose extension is .txt.

[1]:
from galactic.io.data.core import PopulationFactory
import tempfile
from pprint import pprint

data = """\
Observations: 1 2 3 4
Attributes: a b c d e
1: a c
2: a b
3: b d e
4: c e
"""

with tempfile.NamedTemporaryFile(mode="w+t", suffix=".txt") as file:
    file.write(data)
    file.seek(0)
    population = PopulationFactory.create(file)
    pprint({key: list(sorted(value)) for key, value in population.items()}, width=75)
{'1': ['a', 'c'], '2': ['a', 'b'], '3': ['b', 'd', 'e'], '4': ['c', 'e']}