indeksilo


Nameindeksilo JSON
Version 1.0.0 PyPI version JSON
download
home_page
Summarygenerate a multi-level alphabetical index from text in tabular data format
upload_time2023-12-21 14:23:24
maintainer
docs_urlNone
authorhugues de keyzer
requires_python>=3.8,<4.0
licenseAGPL-3.0-or-later
keywords alphabetical index indexer pandas spreadsheet tabular text
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!--
SPDX-FileCopyrightText: 2023 hugues de keyzer

SPDX-License-Identifier: AGPL-3.0-or-later
-->

# indeksilo

indeksilo allows to generate a multi-level alphabetical index from text in tabular data format.

## introduction

text in tabular data format is text formatted as a table (usually stored as a spreadsheet file), where each row of the table contains one word of the text.
one column contains the actual word as it appears in the text, while other columns may contain more information about the word, like the page and line number where it appears, a cleaned-up form (with uniform casing and no punctuation), its lemma, its grammatical category,…

from text in that format, indeksilo generates an alphabetical index (like the ones that appear at the end of books).
see the example section below for a concrete example.

## features

*   multi-level index generation
*   alphabetical sorting using the unicode collation algorithm
*   right-to-left text support
*   multiple values in parent columns support for agglutinated forms
*   multiple reference support (for example: page, line)
*   grouping of identical references with count
*   total count of form occurences at each parent level
*   filtering with regular expressions

## usage

indeksilo takes an input filename and an output filename as arguments, as well as some options.
input and output files should be in opendocument (.ods) or office open xml (.xlsx) format.
the minimal usage is:

```
indeksilo --ref-col ref --form-col form input.ods output.ods
```
where `ref` is the title of the column (in `input.ods`) that contains the reference to use in the index (the page number, for example) and `form` is title of the column (in `input.ods`) that contains the form that will appear in the index.

to display a full description of the usage syntax:

```
indeksilo --help
```

## example

let’s take the following example text, and say that it appears on line 1 and 2 of page 42:

> la suno brilas hodiaŭ. hieraŭ estis malvarme, sed hodiaŭ estas varme.<br>
> ni estas bonŝancaj!

it must first be converted to this format as `input.ods`:

| page | line | word       | form      | lemma      |
| ---- | ---- | ---------- | --------- | ---------- |
| 42   | 1    | la         | la        | la         |
| 42   | 1    | suno       | suno      | suno       |
| 42   | 1    | brilas     | brilas    | brili      |
| 42   | 1    | hodiaŭ.    | hodiaŭ    | hodiaŭ     |
| 42   | 1    | hieraŭ     | hieraŭ    | hieraŭ     |
| 42   | 1    | estis      | estis     | esti       |
| 42   | 1    | malvarme,  | malvarme  | varma      |
| 42   | 1    | sed        | sed       | sed        |
| 42   | 1    | hodiaŭ     | hodiaŭ    | hodiaŭ     |
| 42   | 1    | estas      | estas     | esti       |
| 42   | 1    | varme.     | varme     | varma      |
| 42   | 2    | ni         | ni        | ni         |
| 42   | 2    | estas      | estas     | esti       |
| 42   | 2    | bonŝancaj! | bonŝancaj | bona+ŝanco |

now, let’s generate the index by calling:

```
indeksilo --ref-col page --ref-col line --parent-col lemma --form-col form --split-char + input.ods output.ods
```

this will generate the following table as `output.ods`:

|    | lemma_count | lemma  | form_count | form      | refs         |
| -- | ----------- | ------ | ---------- | --------- | ------------ |
| 0  | 1           | bona   | 1          | bonŝancaj | 42, 2        |
| 1  | 1           | brili  | 1          | brilas    | 42, 1        |
| 2  | 3           | esti   | 2          | estas     | 42, 1; 42, 2 |
| 3  |             |        | 1          | estis     | 42, 1        |
| 4  | 1           | hieraŭ | 1          | hieraŭ    | 42, 1        |
| 5  | 2           | hodiaŭ | 2          | hodiaŭ    | 42, 1 (2)    |
| 6  | 1           | la     | 1          | la        | 42, 1        |
| 7  | 1           | ni     | 1          | ni        | 42, 2        |
| 8  | 1           | ŝanco  | 1          | bonŝancaj | 42, 2        |
| 9  | 1           | sed    | 1          | sed       | 42, 1        |
| 10 | 1           | suno   | 1          | suno      | 42, 1        |
| 11 | 2           | varma  | 1          | malvarme  | 42, 1        |
| 12 |             |        | 1          | varme     | 42, 1        |

note that “bonŝancaj” appears twice in the index, once under the form “bona” and once under the form “ŝanco”.
this is because the lemma column contained two values, separated by the defined split character.

note that the word “hodiaŭ” appears twice on the same line.
this is why its reference has “(2)” appended to it.

## filtering

indeksilo allows to filter rows based on column values using regular expressions.

for example, using the same input file as in the previous example, let’s say that only noun lemmas should appear.
in this case, they all end with “o”, so this command can be used:

```
indeksilo --ref-col page --ref-col line --parent-col lemma --form-col form --split-char + --filter "lemma:.*o" input.ods output.ods
```

in this example, the argument is quoted to avoid the `*` character to be interpreted by the shell.
this depends on the shell used.

this will generate the following table:

|   | lemma_count | lemma | form_count | form      | refs  |
| - | ----------- | ----- | ---------- | --------- | ----- |
| 0 | 1           | ŝanco | 1          | bonŝancaj | 42, 2 |
| 1 | 1           | suno  | 1          | suno      | 42, 1 |

note that “bonŝancaj” appears only once in this case, because the lemma “bona” was filtered out.

multiple filter arguments may be used.
the format of the filter expressions is `col:regex`, where `col` is a column name and `regex` is a regular expression matching the value (after splitting).
any column of the input table can be used, even those not used by the index.

by default, filtering is inclusive, which means that at least one expression should match for the row to be included.
this behavior can be reversed with `--filter-exclude`.
in this case, any row matching an expression is excluded; only the rows not matching any of the expressions are included.

for example, still using the same input file, let’s say that forms with less than 4 letters should be excluded.
this command can be used:

```
indeksilo --ref-col page --ref-col line --parent-col lemma --form-col form --split-char + --filter "form:.{1,3}" --filter-exclude input.ods output.ods
```

this will generate the following table:

|   | lemma_count | lemma  | form_count | form      | refs         |
| - | ----------- | ------ | ---------- | --------- | ------------ |
| 0 | 1           | bona   | 1          | bonŝancaj | 42, 2        |
| 1 | 1           | brili  | 1          | brilas    | 42, 1        |
| 2 | 3           | esti   | 2          | estas     | 42, 1; 42, 2 |
| 3 |             |        | 1          | estis     | 42, 1        |
| 4 | 1           | hieraŭ | 1          | hieraŭ    | 42, 1        |
| 5 | 2           | hodiaŭ | 2          | hodiaŭ    | 42, 1 (2)    |
| 6 | 1           | ŝanco  | 1          | bonŝancaj | 42, 2        |
| 7 | 1           | suno   | 1          | suno      | 42, 1        |
| 8 | 2           | varma  | 1          | malvarme  | 42, 1        |
| 9 |             |        | 1          | varme     | 42, 1        |

indeksilo uses python’s regular expressions.
their documentation is [here](https://docs.python.org/3/library/re.html).

## credits

This development was funded by Bastien Kindt for the GREgORI Project.<br>
<https://uclouvain.be/fr/instituts-recherche/incal/ciol/gregori-project.html><br>
<https://www.v2.gregoriproject.com/>


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "indeksilo",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "alphabetical,index,indexer,pandas,spreadsheet,tabular,text",
    "author": "hugues de keyzer",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/fd/63/8bd1fc0d5fb8e848e704cb9ce387343892bacb84d0eb6daa269daeb19d9c/indeksilo-1.0.0.tar.gz",
    "platform": null,
    "description": "<!--\nSPDX-FileCopyrightText: 2023 hugues de keyzer\n\nSPDX-License-Identifier: AGPL-3.0-or-later\n-->\n\n# indeksilo\n\nindeksilo allows to generate a multi-level alphabetical index from text in tabular data format.\n\n## introduction\n\ntext in tabular data format is text formatted as a table (usually stored as a spreadsheet file), where each row of the table contains one word of the text.\none column contains the actual word as it appears in the text, while other columns may contain more information about the word, like the page and line number where it appears, a cleaned-up form (with uniform casing and no punctuation), its lemma, its grammatical category,\u2026\n\nfrom text in that format, indeksilo generates an alphabetical index (like the ones that appear at the end of books).\nsee the example section below for a concrete example.\n\n## features\n\n*   multi-level index generation\n*   alphabetical sorting using the unicode collation algorithm\n*   right-to-left text support\n*   multiple values in parent columns support for agglutinated forms\n*   multiple reference support (for example: page, line)\n*   grouping of identical references with count\n*   total count of form occurences at each parent level\n*   filtering with regular expressions\n\n## usage\n\nindeksilo takes an input filename and an output filename as arguments, as well as some options.\ninput and output files should be in opendocument (.ods) or office open xml (.xlsx) format.\nthe minimal usage is:\n\n```\nindeksilo --ref-col ref --form-col form input.ods output.ods\n```\nwhere `ref` is the title of the column (in `input.ods`) that contains the reference to use in the index (the page number, for example) and `form` is title of the column (in `input.ods`) that contains the form that will appear in the index.\n\nto display a full description of the usage syntax:\n\n```\nindeksilo --help\n```\n\n## example\n\nlet\u2019s take the following example text, and say that it appears on line 1 and 2 of page 42:\n\n> la suno brilas hodia\u016d. hiera\u016d estis malvarme, sed hodia\u016d estas varme.<br>\n> ni estas bon\u015dancaj!\n\nit must first be converted to this format as `input.ods`:\n\n| page | line | word       | form      | lemma      |\n| ---- | ---- | ---------- | --------- | ---------- |\n| 42   | 1    | la         | la        | la         |\n| 42   | 1    | suno       | suno      | suno       |\n| 42   | 1    | brilas     | brilas    | brili      |\n| 42   | 1    | hodia\u016d.    | hodia\u016d    | hodia\u016d     |\n| 42   | 1    | hiera\u016d     | hiera\u016d    | hiera\u016d     |\n| 42   | 1    | estis      | estis     | esti       |\n| 42   | 1    | malvarme,  | malvarme  | varma      |\n| 42   | 1    | sed        | sed       | sed        |\n| 42   | 1    | hodia\u016d     | hodia\u016d    | hodia\u016d     |\n| 42   | 1    | estas      | estas     | esti       |\n| 42   | 1    | varme.     | varme     | varma      |\n| 42   | 2    | ni         | ni        | ni         |\n| 42   | 2    | estas      | estas     | esti       |\n| 42   | 2    | bon\u015dancaj! | bon\u015dancaj | bona+\u015danco |\n\nnow, let\u2019s generate the index by calling:\n\n```\nindeksilo --ref-col page --ref-col line --parent-col lemma --form-col form --split-char + input.ods output.ods\n```\n\nthis will generate the following table as `output.ods`:\n\n|    | lemma_count | lemma  | form_count | form      | refs         |\n| -- | ----------- | ------ | ---------- | --------- | ------------ |\n| 0  | 1           | bona   | 1          | bon\u015dancaj | 42, 2        |\n| 1  | 1           | brili  | 1          | brilas    | 42, 1        |\n| 2  | 3           | esti   | 2          | estas     | 42, 1; 42, 2 |\n| 3  |             |        | 1          | estis     | 42, 1        |\n| 4  | 1           | hiera\u016d | 1          | hiera\u016d    | 42, 1        |\n| 5  | 2           | hodia\u016d | 2          | hodia\u016d    | 42, 1 (2)    |\n| 6  | 1           | la     | 1          | la        | 42, 1        |\n| 7  | 1           | ni     | 1          | ni        | 42, 2        |\n| 8  | 1           | \u015danco  | 1          | bon\u015dancaj | 42, 2        |\n| 9  | 1           | sed    | 1          | sed       | 42, 1        |\n| 10 | 1           | suno   | 1          | suno      | 42, 1        |\n| 11 | 2           | varma  | 1          | malvarme  | 42, 1        |\n| 12 |             |        | 1          | varme     | 42, 1        |\n\nnote that \u201cbon\u015dancaj\u201d appears twice in the index, once under the form \u201cbona\u201d and once under the form \u201c\u015danco\u201d.\nthis is because the lemma column contained two values, separated by the defined split character.\n\nnote that the word \u201chodia\u016d\u201d appears twice on the same line.\nthis is why its reference has \u201c(2)\u201d appended to it.\n\n## filtering\n\nindeksilo allows to filter rows based on column values using regular expressions.\n\nfor example, using the same input file as in the previous example, let\u2019s say that only noun lemmas should appear.\nin this case, they all end with \u201co\u201d, so this command can be used:\n\n```\nindeksilo --ref-col page --ref-col line --parent-col lemma --form-col form --split-char + --filter \"lemma:.*o\" input.ods output.ods\n```\n\nin this example, the argument is quoted to avoid the `*` character to be interpreted by the shell.\nthis depends on the shell used.\n\nthis will generate the following table:\n\n|   | lemma_count | lemma | form_count | form      | refs  |\n| - | ----------- | ----- | ---------- | --------- | ----- |\n| 0 | 1           | \u015danco | 1          | bon\u015dancaj | 42, 2 |\n| 1 | 1           | suno  | 1          | suno      | 42, 1 |\n\nnote that \u201cbon\u015dancaj\u201d appears only once in this case, because the lemma \u201cbona\u201d was filtered out.\n\nmultiple filter arguments may be used.\nthe format of the filter expressions is `col:regex`, where `col` is a column name and `regex` is a regular expression matching the value (after splitting).\nany column of the input table can be used, even those not used by the index.\n\nby default, filtering is inclusive, which means that at least one expression should match for the row to be included.\nthis behavior can be reversed with `--filter-exclude`.\nin this case, any row matching an expression is excluded; only the rows not matching any of the expressions are included.\n\nfor example, still using the same input file, let\u2019s say that forms with less than 4 letters should be excluded.\nthis command can be used:\n\n```\nindeksilo --ref-col page --ref-col line --parent-col lemma --form-col form --split-char + --filter \"form:.{1,3}\" --filter-exclude input.ods output.ods\n```\n\nthis will generate the following table:\n\n|   | lemma_count | lemma  | form_count | form      | refs         |\n| - | ----------- | ------ | ---------- | --------- | ------------ |\n| 0 | 1           | bona   | 1          | bon\u015dancaj | 42, 2        |\n| 1 | 1           | brili  | 1          | brilas    | 42, 1        |\n| 2 | 3           | esti   | 2          | estas     | 42, 1; 42, 2 |\n| 3 |             |        | 1          | estis     | 42, 1        |\n| 4 | 1           | hiera\u016d | 1          | hiera\u016d    | 42, 1        |\n| 5 | 2           | hodia\u016d | 2          | hodia\u016d    | 42, 1 (2)    |\n| 6 | 1           | \u015danco  | 1          | bon\u015dancaj | 42, 2        |\n| 7 | 1           | suno   | 1          | suno      | 42, 1        |\n| 8 | 2           | varma  | 1          | malvarme  | 42, 1        |\n| 9 |             |        | 1          | varme     | 42, 1        |\n\nindeksilo uses python\u2019s regular expressions.\ntheir documentation is [here](https://docs.python.org/3/library/re.html).\n\n## credits\n\nThis development was funded by Bastien Kindt for the GREgORI Project.<br>\n<https://uclouvain.be/fr/instituts-recherche/incal/ciol/gregori-project.html><br>\n<https://www.v2.gregoriproject.com/>\n\n",
    "bugtrack_url": null,
    "license": "AGPL-3.0-or-later",
    "summary": "generate a multi-level alphabetical index from text in tabular data format",
    "version": "1.0.0",
    "project_urls": null,
    "split_keywords": [
        "alphabetical",
        "index",
        "indexer",
        "pandas",
        "spreadsheet",
        "tabular",
        "text"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "98cc8b463caab6ab60eac4ba18f7d2e4d553bd137d822d32cbf52adab4bd9901",
                "md5": "af4b62a4a943c7088e073a5739f608ba",
                "sha256": "f3b053254e15d90d97e150ffa257f4621580976ddbdfbe2c515236f0b4ba4ab2"
            },
            "downloads": -1,
            "filename": "indeksilo-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "af4b62a4a943c7088e073a5739f608ba",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 30940,
            "upload_time": "2023-12-21T14:23:09",
            "upload_time_iso_8601": "2023-12-21T14:23:09.466088Z",
            "url": "https://files.pythonhosted.org/packages/98/cc/8b463caab6ab60eac4ba18f7d2e4d553bd137d822d32cbf52adab4bd9901/indeksilo-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fd638bd1fc0d5fb8e848e704cb9ce387343892bacb84d0eb6daa269daeb19d9c",
                "md5": "f5c75474e63bfaa58c181cd48fff52b3",
                "sha256": "83f5800c31b79e5a5200c08b406d70fa8f7835e68e86fd4d0b150ef00c01c7eb"
            },
            "downloads": -1,
            "filename": "indeksilo-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f5c75474e63bfaa58c181cd48fff52b3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 18917,
            "upload_time": "2023-12-21T14:23:24",
            "upload_time_iso_8601": "2023-12-21T14:23:24.188039Z",
            "url": "https://files.pythonhosted.org/packages/fd/63/8bd1fc0d5fb8e848e704cb9ce387343892bacb84d0eb6daa269daeb19d9c/indeksilo-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-21 14:23:24",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "indeksilo"
}
        
Elapsed time: 0.23184s