Linguatools Collocation API

Overview

Looks up a word in a dictionary and returns

  • all collocations ordered by significance
  • up to 3 example sentences for each collocation
  • the syntactic relation of each collocation

How to use Linguatools Collocation API

Connect to API

Endpoint and Parameters

Endpoint:
GET /?lang={lang}&query={word}&min_sig={significance}&relation={relation}

parameter description parameter value
query any word (case insensitive) e.g. change
lang One of the following language ISO 639-1 codes (case sensitive): en (more in progress)
relation One of the following relations (case sensitive, optional):

  1. V:obj:N a verb and its object: eat dinner
  2. V:prep:N a verb and its prepositional object: drive by car
  3. V:obj1+2:N a verb and its direct and indirect object: give John money
  4. V:obj+prep:N a verb and its direct object and the indirect object with a preposition: give money to John, drive nail into wall
  5. V:subj:N a verb and its subject: horse gallop
  6. V:sc:V a verb and its dependent verb (sub-clause): let move, force to resign
  7. N:mod:A a noun and its modifying adjective: good friend
  8. N:prep:N a noun with a prepositional phrase: cloud of smoke
  9. N:nn:N a compound noun: power plant
  10. V:mod:A a verb and its modifying adverb: work hard
  11. A:mod:A an adjective and its modifying adverb: really practical
V:obj:N
V:prep:N
V:obj1+2:N
V:obj+prep:N
V:subj:N
V:sc:V
N:mod:A
N:prep:N
N:nn:N
V:mod:A
A:mod:A
min_sig any number as the minimum significance (optional). Will return only collocations with significance >= min_sig. 1,2,3333,75334, etc.

Test the API

You can test the API and develop your own application with our test translate API – for free.

Test the test API with:

  • lang: en
  • query: smoke
  • relation: V:obj:N (optional)

http request

https://lt-collocation-test.herokuapp.com/todos/?query=smoke&lang=en&relation=V:obj:N
wget https://lt-collocation-test.herokuapp.com/todos/?query=smoke&lang=en&relation=V:obj:N

Important note (!):
The initial API call might take up to 15 seconds because the heroku dyno falls asleep after 30 minutes of inactivity. (The test API runs on a free heroku dyno.)

Further limits of the test API:
The test API contains only a subset of the complete collocation database. Only highly significant collocations (significance > 30000) are included. Therefore only 6 thousand collocations are included in the test API. The paid API (see below) contains more than 4 million collocations.

API response

In raw format you will see the html tags <b> and </b> as \u003cb\u003e and \u003c/b\u003e

Code snippets

Ruby

Python

Examples of use

1. Query the complete linguatools collocations database online:
URL: http://www.linguatools.de/kollokationen-en/
2. We make use of collocations in our online tool Gramomat:
URL: https://gramomat.com/ [A click into the object field to see the suggested collocations]

If you want to use the collocation API with 4 millions collocations in your project please contact peter.kolb@linguatools.org for pricing and licence conditions.
Other language APIs by linguatools: https://linguatools.org/language-apis/