[[TOC]]
Your goal is to create an index of words in proposed format:
Word Row,Col
AnotherWord Row,Col; Row,Col
Following text:
Foo bar
bar test
Should produce output like this:
Foo 1,1
bar 1,5; 2,1
test 2,5
We have a very easy CLI for you:
python3 -m book_index FILE
or:
python3 -m book_index FILE --format html
this CLI executes do_it(stream, format)
function from book_index/index.py
we have a pytest environment (you need a pytest installed):
python3 -m pytest
You may use either poetry
or venv
.
It is preinstalled with Python3.
> python3 -m venv book_index_venv
> source book_index_venv/bin/activate
> pip install -r requirements.txt
> python setup.py install
> pytest
Needs to be installed, isntructions here https://python-poetry.org/docs/#installation
Then you can
> poetry install
> poetry shell
> pytest
- Make a list of words from text
- Make a list of tuples, which each tuple has (word, row, col)
- Use these tuples to aggregate words with list of positions
- Think about non-words characters, and conjunction words
- Think about another formats like html, CSV or latex (default is a text format)