LexiTR API Documentation
API endpoints for frequency, collocation, and reverse dictionary queries.
1. Word Frequency API
Returns frequency data for a given word. Queries can target the exact word form or words that start with the given key.
GET
/freq/frequency
| Parameter | Required | Values | Description |
|---|---|---|---|
word |
Yes | Any Turkish word | The word or prefix to search. |
query_type |
Yes | as_is, starts_with |
Controls exact-form or prefix frequency lookup. |
$ curl "http://lexitr.tscorpus.com/freq/frequency?word=akıl&query_type=as_is"
# Example response
{
"word": "akıl",
"query_type": "as_is",
"genre_frequencies": [
{
"word": "akıl",
"academic_freq": 120,
"social_media_freq": 840,
"informative_freq": 530,
"fictional_freq": 410,
"total_freq": 1900
}
]
}
$ curl "http://lexitr.tscorpus.com/freq/frequency?word=ak&query_type=starts_with"
2. Collocation API
Collocation endpoints return case-insensitive node-word matches, positional collocation scores, genre profiles, and corpus attestations for selected collocates.
2.1 Collocation Scores
GET
POST JSON
/col/collocations
| Parameter | Required | Values | Description |
|---|---|---|---|
word |
Yes | Any Turkish word | The node word for collocation lookup. Matching is Turkish case-insensitive. |
genre |
No | all, academic, informative, fictional, social_media |
Corpus genre filter. Defaults to all. |
span |
Yes | 1-5 |
Number of tokens included on the left and right side of the node word. |
type |
No | raw, mi, association, direction, all |
Controls the primary score block. Defaults to all. |
filter |
No | Standart_SW, Greedy_SW, standard, greedy, not_use, none |
Stop-word filter applied to collocation candidates. Defaults to Greedy_SW. |
$ curl "http://lexitr.tscorpus.com/col/collocations?word=akıl&genre=all&span=2&type=all&filter=Greedy_SW"
# Example response
{
"word": "akıl",
"genre": "all",
"span": 2,
"type": "all",
"filter": "Greedy_SW",
"normalized_filter": "greedy",
"matching_lines": 1250,
"matching_sentences": 1250,
"node_occurrences": 1268,
"left_context_tokens": 2500,
"right_context_tokens": 2500,
"corpus_tokens": 195603172,
"score_method": "positional_log_ratio_v2",
"direction_bias_method": "(right-left)/(right+left)",
"raw_scores": [
{
"word": "baş",
"left_frequency": 12,
"right_frequency": 8,
"overall_frequency": 4200
}
],
"mi_scores": [
{
"word": "baş",
"left_frequency": 12,
"left_mi": 1.42,
"right_frequency": 8,
"right_mi": 0.97
}
],
"association_scores": [
{
"word": "baş",
"left_frequency": 12,
"left_score": 1.31,
"right_frequency": 8,
"right_score": 0.86
}
],
"direction_bias_scores": [
{
"word": "baş",
"left_frequency": 12,
"right_frequency": 8,
"direction_bias": -0.2,
"direction": "left",
"left_share": 0.6,
"right_share": 0.4
}
],
"candidate_metrics": []
}
$ curl "http://lexitr.tscorpus.com/col/collocations?word=akıl&genre=academic&span=2&type=raw&filter=Standart_SW"
$ curl "http://lexitr.tscorpus.com/col/collocations?word=akıl&genre=fictional&span=2&type=mi&filter=none"
$ curl -X POST "http://lexitr.tscorpus.com/col/collocations" \
-H "Content-Type: application/json" \
-d '{"word":"akıl","genre":"all","span":2,"type":"all","filter":"Greedy_SW"}'
2.2 Collocate Genre Profile
Returns genre-level counts and normalized rates for a selected query-word / collocate pair.
GET
POST JSON
/col/genre-profile
| Parameter | Required | Values | Description |
|---|---|---|---|
word |
Yes | Any Turkish word | Query node word. query_word is also accepted. |
collocate |
Yes | Any returned collocate | Collocate to profile. collocate_word is also accepted. |
span |
Yes | 1-5 |
Position window used to count left and right occurrences. |
$ curl "http://lexitr.tscorpus.com/col/genre-profile?word=akıl&collocate=baş&span=2"
# Example response
{
"query_word": "akıl",
"collocate_word": "baş",
"span": 2,
"genres": [
{
"genre": "informative",
"corpus_tokens": 91785363,
"query_frequency": 530,
"collocate_frequency": 4200,
"left_frequency": 12,
"right_frequency": 8,
"total_frequency": 20,
"left_per_million": 0.13,
"right_per_million": 0.09,
"total_per_million": 0.22,
"pair_per_1000_query_tokens": 37.74,
"share_pct": 42.55,
"direction_bias": -0.2,
"matching_sentences": 19
}
],
"totals": {
"left_frequency": 25,
"right_frequency": 22,
"total_frequency": 47,
"direction_bias": -0.0638
}
}
2.3 Positional Corpus Attestations
Returns paginated example sentences for a specific positional heatmap cell, such as a collocate at
L1 or R2 of the query word.
GET
/col/positional-attestations
| Parameter | Required | Values | Description |
|---|---|---|---|
word |
Yes | Any Turkish word | Query node word. |
collocate |
Yes | Any returned collocate | Collocate to locate near the node word. |
side |
Yes | left, right |
Whether the collocate must appear before or after the node. |
distance |
Yes | 1-5 |
Exact token distance from the node word. |
genre |
No | all, academic, informative, fictional, social_media |
Corpus genre filter. Defaults to all. |
page |
No | Positive integer | Result page. Defaults to 1. |
page_size |
No | 1-100 |
Attestations per page. Defaults to 20. |
expected_count |
No | Integer | Optional heatmap count used to verify the retrieved attestation count. |
$ curl "http://lexitr.tscorpus.com/col/positional-attestations?word=akıl&collocate=baş&side=left&distance=1&page=1&page_size=5"
# Example response
{
"query_word": "akıl",
"collocate_word": "baş",
"side": "left",
"distance": 1,
"position": "L1",
"genre": "all",
"page": 1,
"page_size": 5,
"pages": 3,
"total_attestations": 12,
"total_sentences": 12,
"retrieval_mode": "pair_fulltext",
"heatmap_expected_count": null,
"count_consistent": true,
"examples": [
{
"attestation_number": 1,
"sentence_id": 12345,
"sentence": "...",
"tokens": ["..."],
"genre": "informative",
"node_index": 8,
"collocate_index": 7
}
]
}
2.4 Single Word Frequency Helper
Returns the same genre-frequency distribution used by the Collocationary interface for an inline word-frequency chart.
POST JSON
/col/trigger-function
| Parameter | Required | Values | Description |
|---|---|---|---|
word |
Yes | Any Turkish word | Word form to look up in the frequency table. |
$ curl -X POST "http://lexitr.tscorpus.com/col/trigger-function" \
-H "Content-Type: application/json" \
-d '{"word":"akıl"}'
3. Reverse Dictionary API
Returns words that end with a given key. For example, key=mut can return words such as armut and bizmut.
GET
POST JSON
/reverse/search
| Parameter | Required | Values | Description |
|---|---|---|---|
key |
Yes | Ending sequence | The final letters or syllable sequence to match. syl is also accepted as an alias. |
w_type |
No | All, Single_Word, Multi_Word |
Word type filter. Defaults to All. |
source |
No | All, TS_Corpus, TDK_Dictionary |
Source filter. Defaults to All. |
limit |
No | 1-1000 | Maximum number of returned matches. Defaults to 500. |
$ curl "http://lexitr.tscorpus.com/reverse/search?key=mut&w_type=All&source=All&limit=50"
# Example response
{
"key": "mut",
"w_type": "All",
"source": "All",
"limit": 50,
"match_count": 2,
"results": [
{
"id": 101,
"word": "armut",
"w_type": "Single_Word",
"s_count": 2,
"tagged": "ar+VC mut+CVC",
"s_type": "open",
"s_kind": "N",
"source": "TDK_Dictionary"
}
]
}
$ curl -X POST "http://lexitr.tscorpus.com/reverse/search" \
-H "Content-Type: application/json" \
-d '{"key":"mut","w_type":"Single_Word","source":"TDK_Dictionary","limit":25}'