Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 8 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ network calls, external API keys, or `.env` setup required.
|--|--|
| `POST /api/MarkAccent/` | Mark pitch accent + furigana on the whole input, returns one `AccentResponse`. |
| `POST /api/MarkAccent/stream/` | Same pipeline, streams one NDJSON object per `\n`-split sentence in input order. |
| `POST /api/UsageQuery/HeadWords/` | Look up Yahoo Realtime/News headwords for a query (delegates to an external HTTP endpoint). |
| `POST /api/UsageQuery/URL/` | Resolve headword references to URLs. |
| `POST /api/DictQuery/` | JMdict dictionary lookup. |
| `POST /api/SentenceQuery/` | Example-sentence search. |

`MarkAccent` is the whole service. The `DictQuery`,
`SentenceQuery` and `UsageQuery` endpoints that lived here previously
were removed in #54: each was an HTML scrape of an external site
(EDRDG JMdictDB, EDRDG WWWJDIC, Yahoo), all three saw little use, and
JMdictDB moved behind a password gate that broke `DictQuery`
outright. Nothing in the service makes a network call at request time
any more.

The MarkFurigana endpoint that lived in earlier versions of the
service was removed during the Yahoo MA → local fugashi migration;
Expand Down Expand Up @@ -189,30 +193,6 @@ curl -s -X POST http://127.0.0.1:8000/api/MarkAccent/ \
-d '{"text":"三月五日(土)"}' | python -m json.tool
```

## How to use a shared `httpx.AsyncClient`

If your router needs to send HTTP requests, follow this pattern to
reuse the connection pool managed by `api.dependencies`:

```python
import httpx
from fastapi import APIRouter, Depends
from api.dependencies import get_http_client

router = APIRouter()

@router.post("/Foo/", tags=["Foo"], response_model=FooResponse)
async def foo(
request: FooRequest, client: httpx.AsyncClient = Depends(get_http_client)
):
try:
response = await client.post(url)
except httpx.TimeoutException:
...
except httpx.HTTPError as e:
...
```

## Known limitations

- **UniDic-vs-OpenJTalk reading mismatches.** A handful of kanji come
Expand Down
20 changes: 0 additions & 20 deletions api/dependencies.py

This file was deleted.

151 changes: 0 additions & 151 deletions api/dict_query.py

This file was deleted.

109 changes: 0 additions & 109 deletions api/sentence_query.py

This file was deleted.

Loading
Loading