C-SALT APIs for Sanskrit Dictionaries

Overview

The C-SALT (Cologne South Asian Languages and Texts) APIs for Sanskrit dictionaries are product of a novel workflow for manipulating lexical data. The starting point is a TEI file from which entries are extracted and indexed in an elasticsearch server that can be accessed either through a GraphQL or a REST API. The TEI files are hosted on Github and if modified, trigger an automatic update of the index. This update takes place only if the modifications have been previously approved by scholars.

APIs

We currently offer GraphQL and REST APIs for the following dictionaries:

Sanskrit-English:

Sanskrit-German:

GraphQL API

2 types of queries are available:

ids
entries

Query examples for GRA:

{
  ids(dictId: "gra", lemmaId: ["lemma_praT_5904", "lemma_kapfT_2423"], size:2) {
    id
    headwordDeva
    headwordIso

  }
}
{
  entries(dictId: "gra", queryType: "prefix", query: "agni", field: "headword_slp1") {
    id
    headwordDeva
    headwordSlp1
  }
}

Query examples for AP90:

{
  entries(dictId: "ap90", queryType: "fuzzy", query: "ams", field: "headword_iso") {
    id
    headwordDeva
    headwordIso
  }
}
{
  entries(dictId: "ap90", queryType: "prefix", query: "agni", field: "headword_slp1") {
    id
    headwordDeva
    headwordSlp1
  }
}

Query examples for BHS:

{
  entries(dictId: "bhs", queryType: "regexp", query: ".*ka", field: "headword_iso") {
    id
    headwordDeva
    headwordIso
  }
}
{
  entries(dictId: "bhs", queryType: "prefix", query: "agni", field: "headword_slp1") {
    id
    headwordDeva
    headwordSlp1
  }
}

Query examples for VEI:

{
  entries(dictId: "vei", queryType: "regexp", query: ".*aka", field: "headword_iso") {
    id
    headwordDeva
    headwordIso
  }
}
{
  entries(dictId: "vei", queryType: "prefix", query: "agni", field: "headword_slp1") {
    id
    headwordDeva
    headwordSlp1
  }
}

REST API

The REST API currently offers two endpoints for accesing lexical data:

GET='/dicts/sa/rest/search/(dict_id)'

This endpoint allows the client to make three different types of searches:

1.1 Default search

Parameters:

q : The query and default parameter. If the query_type is not specified, a term query is executed in the fields headword_iso and entry_tei_iso.

query_type: For understanding the possibilities that elasticsearch offers, please read Term Level Queries and Full Text Queries.

Examples:

GRA

AP90

BHS

VEI

1.2 Headword search

Parameters:

headword: The headword that you are searching for.
input_translit: The transliteration input (hk=Harvard-Kyoto, slp1=SLP1, iso=ISO-15919, ascii= ASCII, gra= Grassmann’s notation, deva= Devanagari)
query_type: For understanding the possibilities that elasticsearch offers, please read Term Level Queries

Examples:

GRA:

AP90

BHS

VEI

1.3 Entry search

Paramaters:

entry: The entry that your are searching for.
query_type: For understanding the possibilities that elasticsearch offers, please read Full Text Queries

Examples:

GRA

AP90

BHS

VEI

2 Headword_id

GET='dicts/gra/rest/headword_id/(dict_id)/'

Examples:

GRA:

AP90

BHS

VEI