home << dhlab reference << dhlab.api.dhlab_api

urn_collocation#

from dhlab.api.dhlab_api import urn_collocation
urn_collocation(urns=None, word='arbeid', before=5, after=0, samplesize=200000)[source]#

Create a collocation from a list of URNs.

Call the API BASE_URL endpoint /urncolldist_urn.

Parameters:
  • urns (list) – list of uniform resource name strings, for example: ["URN:NBN:no-nb_digibok_2008051404065", "URN:NBN:no-nb_digibok_2010092120011"]

  • word (str) – word to construct collocation with.

  • before (int) – number of words preceding the given word.

  • after (int) – number of words following the given word.

  • samplesize (int) – total number of urns to search through.

Returns:

a pandas.DataFrame with distance (sum of distances and bayesian distance) and frequency for words collocated with word.

Return type:

DataFrame