Metadata-Version: 2.4
Name: concinno-skills-content
Version: 0.1.0
Summary: Content writing agent skills (article extract / Google News / keyword / rewrite) for Concinno — newspaper3k, gnews, keybert.
Project-URL: Homepage, https://github.com/aiking931931/concinno
Project-URL: Issues, https://github.com/aiking931931/concinno/issues
Project-URL: Changelog, https://github.com/aiking931931/concinno/blob/main/projects/concinno-skills-content/CHANGELOG.md
Author-email: "AI King (Chen-Xuan Wang)" <me@ai-king.dev>
License-Expression: Apache-2.0
Keywords: agent,concinno,content,keyword,news,newspaper,rewrite,seo,skills
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Linguistic
Requires-Python: >=3.10
Requires-Dist: concinno>=2.15.1
Requires-Dist: gnews>=0.3
Requires-Dist: keybert>=0.8
Requires-Dist: newspaper3k>=0.2
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-cov>=5; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.7; extra == 'dev'
Description-Content-Type: text/markdown

# concinno-skills-content

Content-writer agent skills for [Concinno](https://pypi.org/project/concinno/) —
article extraction, Google News search, keyword extraction, rule-based text
rewrite. Native Python only; no API keys needed for the MVP surface.

## Status

MVP (0.1.0) — four tools, all offline-cleanable. This is the fourth
sub-package in the `concinno-skills-*` ecosystem (after `-google`), built
to the same entry-points + Tool-protocol pattern.

## Tools

| Tool | Action(s) | Library | Concurrency-safe |
|---|---|---|---|
| `ArticleExtract` | `parse` | `newspaper3k` | False (HTTP + lazy models) |
| `GoogleNewsSearch` | `search` | `gnews` | False (HTTP) |
| `KeywordExtract` | `extract` | `keybert` + `sentence-transformers` | True |
| `TextRewrite` | `rewrite` / `shorten` / `remove_ads` | stdlib only | True |

## Install

```bash
pip install concinno-skills-content
```

Heads-up before first use:

- **KeyBERT downloads a ~90MB SBERT model on first call**
  (`all-MiniLM-L6-v2` by default) to `~/.cache/huggingface/`. One-shot per
  machine. Larger / multilingual models are selectable via the `model`
  kwarg; KeyBERT's own README lists the options. `sentence-transformers`
  itself is a hard dependency of `keybert>=0.8` and will be installed
  automatically — the full dep chain including `transformers` + `torch`
  takes ~1-2GB of disk.
- **`newspaper3k` + Python 3.12/3.13**: `newspaper3k` has not seen an
  upstream release since 2018 and pins `lxml`. If `pip install` fails on
  3.12+ due to a C-extension build, the usual fix is
  `pip install --upgrade lxml_html_clean` + the latest `lxml` wheel.
  Tracking issue: <https://github.com/codelucas/newspaper/issues>.

No OAuth, no API keys — every MVP tool uses public RSS / local compute
only. `_auth.py` is a placeholder for future paid-API sub-packages.

## Usage via Concinno `ToolRegistry`

When the consumer sets `CONCINNO_LOAD_PLUGINS=1`, the default registry
auto-mounts all four tools:

```python
import os
os.environ["CONCINNO_LOAD_PLUGINS"] = "1"

from concinno.tools.registry import get_default_registry

reg = get_default_registry()
names = set(reg.list_deferred())
assert {"ArticleExtract", "GoogleNewsSearch",
        "KeywordExtract", "TextRewrite"} <= names

tool = reg.get("ArticleExtract")
article = tool.call(
    action="parse",
    url="https://news.example/article-url",
    lang="en",
)
```

## Direct Python usage

```python
from concinno_skills_content import (
    ArticleExtract, GoogleNewsSearch,
    KeywordExtract, TextRewrite,
)

# 1) Discover
search = GoogleNewsSearch().call(
    action="search",
    query="AI agents",
    limit=5,
    lang="en",
    country="US",
    period="7d",
)

# 2) Extract
article = ArticleExtract().call(
    action="parse",
    url=search["items"][0]["url"],
    lang="auto",  # collapsed to "en" — newspaper3k has no real auto
)

# 3) Keyword SEO
kws = KeywordExtract().call(
    action="extract",
    text=article["text"],
    top_n=10,
    ngram_range=[1, 2],
)

# 4) Clean copy for downstream LLM
clean = TextRewrite().call(
    action="remove_ads", text=article["text"],
)["text"]
clean = TextRewrite().call(
    action="rewrite", text=clean,
)["text"]
```

All tools return either a structured success dict or `{"error": "..."}`
— never raise. Matches the rest of the Concinno tool ecosystem.

## License

Apache-2.0. See `LICENSE` in the Concinno monorepo.
