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

Returns collocation scores for a given word, genre, and span. This endpoint always applies the Greedy_SW stop-word filter.

GET POST JSON /col/collocations

Parameter Required Values Description
word Yes Any Turkish word The node word for collocation lookup.
genre No all, academic, informative, fictional, social_media Corpus genre filter. Defaults to all.
span Yes Integer Context window value used by the collocation query.
type No raw, mi, all Controls returned score blocks. Defaults to all.
$ curl "http://lexitr.tscorpus.com/col/collocations?word=akıl&genre=all&span=2&type=all"

# Example response
{
  "word": "akıl",
  "genre": "all",
  "span": 2,
  "type": "all",
  "filter": "Greedy_SW",
  "matching_lines": 1250,
  "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
    }
  ]
}
$ curl "http://lexitr.tscorpus.com/col/collocations?word=akıl&genre=academic&span=2&type=raw"

$ curl "http:/lexitr.tscorpus.com/col/collocations?word=akıl&genre=fictional&span=2&type=mi"
$ curl -X POST "http://lexitr.tscorpus.com/col/collocations" \
  -H "Content-Type: application/json" \
  -d '{"word":"akıl","genre":"all","span":2,"type":"all"}'
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}'