Below are the API specifications for the Syntax Analyzer project, offering features such as syntax analysis and random sentence generation.
This endpoint uses specified AI models to analyze the syntax of tokenized sentences, breaking them down into grammatical elements for detailed structural insights.
POST /analyzer
| Field | Type | Options | Required | Description | Constraints |
|---|---|---|---|---|---|
model | string | primary, primary-ft, fast-ft | Yes | Analysis model key (provider model alias) | One of: primary, primary-ft, fast-ft |
sentence | Array<string> | N/A | Yes | Tokens for analysis | Range: 2~20 tokens |
Example Request
{
"model": "fast-ft",
"sentence": ["My", "name", "is", "John", "."]
}model=primary: 2 analysis creditsmodel=primary-ft: 2 analysis creditsmodel=fast-ft: 1 analysis credit
Analysis Data Model
typeAnalysisSource='user'|'sample';typeISODateString=string;typeConstituentType='clause'|'phrase'|'token';typeTConstituent={id: number;// Random 9-digit numberelementId: number;// Constituent IDlabel: string;// Grammatical label, e.g., "subject"abbreviation: string;// Abbreviation, e.g., "s"type: ConstituentType;// Type of constituent};typeTSegment={id: number;// Random 9-digit numberbegin: number;// Start indexend: number;// End indexconstituents: TConstituent[];// Segment constituentschildren: TSegment[];// Sub-segments};typeTAnalysis={id: string;// Random 21-byte stringsource: AnalysisSource;// Data sourcecreatedAt: ISODateString;// ISO 8601 timestampsentence: string[];// Tokenized sentencerootSegment: TSegment;// Root segmentisAnalyzedByGPT: boolean;// AI-analyzed status};200 OK
{
"id": "YW6AX-AOZb2-xYXt05xkn",
"source": "user",
"createdAt": "2023-05-10T23:08:08.000Z",
"sentence": ["My", "name", "is", "John", "."],
"rootSegment": {
"id": 840296172,
"begin": 0,
"end": 5,
"constituents": [],
"children": [
{
"id": 987654321,
"begin": 0,
"end": 2,
"constituents": [
{
"id": 456789123,
"elementId": 1,
"label": "subject",
"abbreviation": "s",
"type": "token"
}
],
"children": []
},
{
"id": 789123456,
"begin": 2,
"end": 3,
"constituents": [
{
"id": 321654987,
"elementId": 2,
"label": "verb",
"abbreviation": "v",
"type": "token"
}
],
"children": []
},
{
"id": 654321789,
"begin": 3,
"end": 4,
"constituents": [
{
"id": 654987321,
"elementId": 5,
"label": "object",
"abbreviation": "o",
"type": "token"
}
],
"children": []
},
{
"id": 321789654,
"begin": 4,
"end": 5,
"constituents": [],
"children": []
}
]
},
"isAnalyzedByGPT": true
}400 Bad Request
{
"errors": [
{
"type": "field",
"value": "value that caused the error",
"msg": "Error description",
"path": "field_name",
"location": "body"
}
]
}This endpoint generates random sentences, optionally constrained by sentence count, character limit, and topics.
GET /analyzer/random-sentences
| Field | Type | Required | Default | Description | Constraints |
|---|---|---|---|---|---|
sent_count | number | No | 3 | Quantity of sentences | Range: 1~5 |
max_chars | number | No | 80 | Character limit per sentence | Range: 10~80 |
topics | Array<string> | No | [] | Topics to include in sentences | Max 3 topics |
200 OK
[
"Apples are a popular fruit that come in many different varieties.",
"Apple trees are typically grown in orchards for commercial production.",
"Apple cider is a refreshing beverage made from pressed apples.",
]400 Bad Request
{
"errors": [
{
"type": "field",
"value": "value that caused the error",
"msg": "Error description",
"path": "field_name",
"location": "query"
}
]
}This endpoint provides remaining user quotas for syntax analysis and random sentences, resetting daily to 10 and 20, respectively.
GET /analyzer/remaining-counts
200 OK
{
"analysis": 10,
"random_sentence": 20
}analysis: Remaining count for syntax analysisrandom_sentence: Remaining count for random sentence generation
400 Bad Request
{
"status": "error",
"message": "Error description"
}