Metadata-Version: 2.5
Name: sentence-struct
Version: 0.1.2
Summary: Multilingual sentence structure analysis: sentences with tokens and syntactic chunks
Project-URL: Homepage, https://github.com/memshare-project/sentence-struct
Project-URL: Repository, https://github.com/memshare-project/sentence-struct
Project-URL: Issues, https://github.com/memshare-project/sentence-struct/issues
Project-URL: Changelog, https://github.com/memshare-project/sentence-struct/blob/main/CHANGELOG.md
Author: sentence-struct contributors
License-Expression: MIT
License-File: LICENSE
Keywords: chunking,japanese,linguistics,nlp,sentence-structure,tokenization
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Text Processing :: Linguistic
Requires-Python: >=3.11
Requires-Dist: ginza>=5.2.1
Requires-Dist: ja-ginza>=5.2.0
Requires-Dist: spacy>=3.8.0
Requires-Dist: sudachidict-core>=20240409
Requires-Dist: sudachipy>=0.6.8
Provides-Extra: dev
Requires-Dist: pytest-cov>=6.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Provides-Extra: ja-full
Requires-Dist: sudachidict-full>=20240409; extra == 'ja-full'
Description-Content-Type: text/markdown

# sentence-struct

Analyze text into a learner-friendly structure:

**document → sentences[] → { tokens[], chunks[] }**

Chunks are siblings of tokens and reference them via `tokenIndices` (not nested).

Japanese (`ja`) is implemented first via GiNza / Sudachi. More languages later.

## Install

```bash
pip install sentence-struct
# or
uv add sentence-struct
```

Optional larger Sudachi dictionary:

```bash
pip install "sentence-struct[ja-full]"
```

Requires Python ≥ 3.11. First install pulls spaCy / GiNza / Sudachi (hundreds of MB).

## Usage

```python
from sentence_struct import analyze

doc = analyze("秋が近づくにつれ、朝晩の涼しさが心地よい。", language="ja")
print(doc["sentence_count"], doc["token_count"], doc["chunk_count"])
print(doc["sentences"][0]["tokens"][0])
print(doc["sentences"][0]["chunks"][0])
```

CLI:

```bash
sentence-struct "秋が近づく。"
sentence-struct -f essay.txt -o out.json
```

## Schema (abbreviated)

```json
{
  "language": "ja",
  "text": "...",
  "sentences": [
    {
      "index": 1,
      "text": "...",
      "tokens": [
        {"text": "秋", "pos": "名詞", "posGroup": "名詞", "lemma": "秋", "reading": "アキ"}
      ],
      "chunks": [
        {"type": "NP", "typeGroup": "NP", "tokenIndices": [0, 1], "text": "秋が", "role": "nsubj"}
      ]
    }
  ]
}
```

## Develop (uv)

```bash
uv sync
uv run pytest -m "not integration"
uv run pytest -m integration
uv run sentence-struct "今日は良い天気です。"
```

## Release

See [RELEASING.md](RELEASING.md). Tag `vX.Y.Z` → GitHub Actions builds with **uv** and publishes to PyPI via Trusted Publishing.

## License

MIT
