This project provides a similar API to yomitan-api for the annotation functionality of asbplayer, based on spaCy's tokenizer.
- Install uv.
- Clone this repository:
git clone https://github.com/mootah/morph-api.git cd morph-api - Initialize the project:
uv sync
- Start the server:
uv run task server
- In asbplayer, set the
Yomitan API URLtohttp://127.0.0.1:19634.
- method:
POST
-
response (200):
{ "version": 1 }
- method:
POST
-
response (200):
{ "version": "<latest yomitan version>" }
- method:
POST - Content-Type:
application/jsonorapplication/octet-stream(for JSON bytes) - body:
text:string|list[string]scanLength:int
-
request:
{ "text": "This is it.", "scanLength": 10 } -
response (200):
[ { "id": "scan", "source": "scanning-parser", "dictionary": null, "index": 0, "content": [ [ { "text": "This", "reading": "" } ], [ { "text": "is", "reading": "" } ], [ { "text": "it", "reading": "" } ], [ { "text": ".", "reading": "" } ] ] } ]
- method:
POST - Content-Type:
application/jsonorapplication/octet-stream(for JSON bytes) - body:
term:string
-
request:
{ "term": "running" } -
response (200):
{ "dictionaryEntries": [ { "type": "term", "isPrimary": true, "textProcessorRuleChainCandidates": [ [] ], "inflectionRuleChainCandidates": [], "score": 0, "frequencyOrder": 0, "dictionaryIndex": 0, "dictionaryAlias": "spaCy", "sourceTermExactMatchCount": 1, "matchPrimaryReading": false, "maxOriginalTextLength": 7, "headwords": [ { "index": 0, "term": "running", "reading": "", "sources": [ { "originalText": "running", "transformedText": "running", "deinflectedText": "run", "matchType": "exact", "matchSource": "term", "isPrimary": true } ], "tags": [], "wordClasses": [ "VERB" ] } ], "definitions": [], "frequencies": [], "pronunciations": [] } ], "originalTextLength": 7 }