{"basePath":"/dhlab","definitions":{},"host":"api.nb.no","info":{"description":"powered by Flasgger","termsOfService":"/tos","title":"A swagger API","version":"0.0.1"},"paths":{"/build_corpus":{"post":{"consumes":["application/json"],"parameters":[{"in":"body","name":"build_corpus","required":true,"schema":{"properties":{"author":{"description":"author/creator of the document","example":"Ibsen","type":"string"},"city":{"description":"place of publication","example":"Oslo","type":"string"},"ddk":{"description":"Dewey decimal classification","example":"839.82","type":"string"},"doctype":{"description":"the document type","enum":["digibok","digavis","digitidsskrift","digistorting"],"example":"digibok","type":"string"},"freetext":{"description":"any of the fields","example":"digibok AND Ibsen","type":"string"},"from_timestamp":{"description":"minimum date of publication (YYYYMMDD, books have YYYY0101)","example":18500101,"type":"integer"},"from_year":{"description":"minimum year of publication","example":1850,"type":"integer"},"fulltext":{"description":"words within the publication","example":"Norge","type":"string"},"genres":{"description":"genre of the publication","example":"novel","type":"string"},"lang":{"description":"language(s) of the publication","example":"nob","type":"string"},"limit":{"description":"number of items to sample","example":10000,"type":"integer"},"literaryform":{"description":"literary form of the publication (books)","example":"Skj\u00f8nnlitteratur","type":"string"},"order_by":{"description":"determines the order of the result set","enum":["random","rank","first"],"example":"first","type":"string"},"publisher":{"description":"publisher","example":"Gyldendal","type":"string"},"subject":{"description":"subject (keywords) of the publication","example":"dikt","type":"string"},"title":{"description":"title of the publication","example":"dikt","type":"string"},"to_timestamp":{"description":"maximum date of publication (YYYYMMDD, books have YYYY0101)","example":20210101,"type":"integer"},"to_year":{"description":"maximum year of publication","example":2021,"type":"integer"}},"type":"object"}}],"responses":{"200":{"description":"a table of metadata"}},"summary":"Build corpus from metadata"}},"/chunks":{"get":{"parameters":[{"description":"a URN","in":"query","name":"urn","required":true,"type":"string"},{"description":"size of chunk","in":"query","name":"chunk_size","required":true,"type":"integer"}],"responses":{"200":{"description":"A list of dictionaries with word frequencies for each chunk"}},"summary":"Fetch chunks as wordbags from a document URN"}},"/chunks_para":{"get":{"parameters":[{"description":"a URN","in":"query","name":"urn","required":true,"type":"string"},{"description":"size of chunk","in":"query","name":"chunk_size","required":true,"type":"integer"}],"responses":{"200":{"description":"A list of dictionaries with word frequencies for each chunk"}},"summary":"Fetch chunks (within paragraphs) as wordbags from a document URN"}},"/conc":{"post":{"consumes":["application/json"],"parameters":[{"in":"body","name":"conc","required":true,"schema":{"ooneOf":[{"required":["dhlabids"]},{"required":["urns"]}],"properties":{"dhlabids":{"description":"a list of dhlabids","example":[100000000,100000001],"type":"array"},"html_formatting":{"default":true,"description":"pads the text snippets with \"...\", and wraps the target word(s) in html boldface tags (<b></b>)","type":"boolean"},"limit":{"description":"max. number of concordances per document","example":1000,"maximum":1000,"minimum":0,"type":"integer"},"query":{"description":"a SQLite fulltext query","example":"Norge","type":"string"},"trigram_index":{"default":false,"description":"uses an experimental character trigram index for search (case sensitive)","type":"boolean"},"urns":{"description":"a list of URNs","example":["URN:NBN:no-nb_digibok_2008051404065","URN:NBN:no-nb_digibok_2010092120011"],"type":"array"},"window":{"description":"collocation window to show","example":20,"maximum":25,"minimum":1,"type":"integer"}},"type":"object"}}],"responses":{"200":{"description":"a table of concordances"}},"summary":"Return concordances (keyword in context) for a corpus query"}},"/conccount":{"post":{"consumes":["application/json"],"parameters":[{"in":"body","name":"conccount","required":true,"schema":{"ooneOf":[{"required":["dhlabids"]},{"required":["urns"]}],"properties":{"dhlabids":{"description":"a list of dhlabids","example":[100000000,100000001],"type":"array"},"limit":{"description":"max. number of concordances per document","example":1000,"maximum":1000,"minimum":0,"type":"integer"},"query":{"description":"a SQLite fulltext query","example":"Norge","type":"string"},"trigram_index":{"default":false,"description":"uses an experimental character trigram index for search (case sensitive)","type":"boolean"},"urns":{"description":"a list of URNs","example":["URN:NBN:no-nb_digibok_2008051404065","URN:NBN:no-nb_digibok_2010092120011"],"type":"array"},"window":{"description":"collocation window to show","example":10,"maximum":100,"minimum":1,"type":"integer"}},"type":"object"}}],"responses":{"200":{"description":"a table of counts"}},"summary":"Return counts from concordances (keyword in context) for a corpus query (used for collocation analysis)"}},"/dispersion":{"post":{"consumes":["application/json"],"parameters":[{"in":"body","name":"dispersion_data","required":true,"schema":{"properties":{"pr":{"description":"sample position","example":100,"required":false,"type":"integer"},"urn":{"description":"a URN","example":"URN:NBN:no-nb_digibok_2011051112001","required":true,"type":"string"},"window":{"description":"the window to count within","example":500,"required":false,"type":"integer"},"words":{"description":"a list of words","example":["og","eller","men","for"],"required":false,"type":"array"}},"type":"object"}}],"responses":{"200":{"description":"a list of lists of frequencies per block"}},"summary":"Compute dispersion of word in urn"}},"/frequencies":{"post":{"consumes":["application/json"],"parameters":[{"in":"body","name":"api_frequencies","required":true,"schema":{"properties":{"cutoff":{"description":"cut-off frequency","example":1,"required":true,"type":"integer"},"urns":{"description":"a list of URNs","example":["URN:NBN:no-nb_digibok_2011051112001"],"required":true,"type":"array"},"words":{"description":"a list of words","example":["og","i","som"],"required":true,"type":"array"}},"type":"object"}}],"responses":{"200":{"description":"a document-term matrix (dtm)"}},"summary":"Get frequencies of words for a URN or multiple URNs"}},"/get_metadata":{"post":{"consumes":["application/json"],"parameters":[{"in":"body","name":"get_metadata","required":true,"schema":{"oneOf":[{"required":["dhlabids"]},{"required":["urns"]}],"properties":{"dhlabids":{"description":"an array of dhlabids from the National Library of Norway","example":[100000000],"items":{"type":"integer"},"type":"array"},"urns":{"description":"an array of URNs from the National Library of Norway","example":["URN:NBN:no-nb_digibok_2011051604088"],"items":{"type":"string"},"type":"array"}},"type":"object"}}],"responses":{"200":{"description":"a table of metadata"}},"summary":"Get metadata for a list of URNs"}},"/id/{dhlabid}":{"get":{"parameters":[{"in":"path","name":"dhlabid","required":true,"type":"integer"}],"responses":{"200":{"description":"A JSON object with metadata"}},"summary":"Returns basic metadata for a specific dhlabid"}},"/id/{doctype}/next":{"get":{"parameters":[{"in":"path","name":"doctype","required":true,"type":"string"}],"responses":{"200":{"description":"A JSON object with the next available id"},"404":{"description":"No id series exists for this doctype"}},"summary":"Returns the next available dhlabid for a given doctype"}},"/imagination_geo_data":{"get":{"parameters":[{"description":"dhlabid","in":"query","name":"dhlabid","required":true,"type":"string"}],"responses":{"200":{"description":"a table of (canonical) placenames with coordinates (geonameid, name, alternatename, latitude, longitude, feature_class, feature_code)"}},"summary":"Look up placenames in a specific URN or dhlabid."}},"/imagination_geo_data_list":{"post":{"consumes":["application/json"],"description":"<br/>","parameters":[{"in":"body","name":"dhlabids","required":true,"schema":{"properties":{"dhlabids":{"description":"a list of dhlabids","example":[100489138,100616423,100635581,100637176,100614144],"required":true,"type":"array"}},"type":"object"}}],"responses":{"200":{"description":"a table of (canonical) placenames with coordinates (geonameid, name, alternatename, latitude, longitude, feature_class, feature_code)"}},"summary":"Look up placenames in a list of specific URNs or dhlabids."}},"/ngram_book":{"post":{"consumes":["application/json"],"parameters":[{"in":"body","name":"ngram_book","required":true,"schema":{"properties":{"city":{"description":"publication city","required":false,"type":"string"},"ddk":{"description":"dewey","required":false,"type":"string"},"lang":{"description":"language of the book","required":false,"type":"string"},"period":{"description":"period of publication (yearfrom, yearto)","example":[1990,2020],"required":false,"type":"array"},"publisher":{"description":"publisher","required":false,"type":"string"},"title":{"description":"title of book","required":false,"type":"string"},"topic":{"description":"subject word","required":false,"type":"string"},"word":{"description":"a list of words (unigrams)","example":["sushi","pizza"],"required":true,"type":"array"}},"type":"object"}}],"responses":{"200":{"description":"a dictionary of word frequencies (word + year as key)"}},"summary":"Get aggregated n-gram statistics for books (unigrams)"}},"/ngram_newspapers":{"post":{"consumes":["application/json"],"parameters":[{"in":"body","name":"ngram_newspapers","required":true,"schema":{"properties":{"city":{"description":"publication city","example":"Oslo","required":false,"type":"string"},"period":{"description":"period of publication (yearfrom, yearto)","example":[1990,2020],"required":false,"type":"array"},"title":{"description":"title of the newspaper","example":"aftenposten","required":false,"type":"string"},"word":{"description":"a list of words (unigrams)","example":["sushi","pizza"],"required":true,"type":"array"}},"type":"object"}}],"responses":{"200":{"description":"a dictionary of word frequencies (word + year as key)"}},"summary":"Get aggregated n-gram statistics for newspapers (unigrams)"}},"/ngram_periodicals":{"post":{"consumes":["application/json"],"parameters":[{"in":"body","name":"ngram_periodicals","required":true,"schema":{"properties":{"city":{"description":"publication city","required":false,"type":"string"},"ddk":{"description":"dewey","required":false,"type":"string"},"lang":{"description":"language of the volume","required":false,"type":"string"},"period":{"description":"period of publication (yearfrom, yearto)","example":[1990,2020],"required":false,"type":"array"},"publisher":{"description":"publisher","required":false,"type":"string"},"title":{"description":"title of periodical","required":false,"type":"string"},"topic":{"description":"subject word","required":false,"type":"string"},"word":{"description":"a list of words (unigrams)","example":["sushi","pizza"],"required":true,"type":"array"}},"type":"object"}}],"responses":{"200":{"description":"a dictionary of word frequencies (word + year as key)"}},"summary":"Get aggregated n-gram statistics for periodicals (unigrams)"}},"/places":{"post":{"consumes":["application/json"],"parameters":[{"in":"body","name":"get_places","required":true,"schema":{"properties":{"feature_class":{"description":"a GeoNames feature class","example":"P","required":false,"type":"string"},"feature_code":{"description":"a GeoNames feature code","example":"PPL","required":false,"type":"string"},"urn":{"description":"URN","example":"URN:NBN:no-nb_digibok_2011051112001","required":true,"type":"string"}},"type":"object"}}],"responses":{"200":{"description":"a table of potential placenames with coordinates (geonameid, name, alternatename, latitude, longitude, feature_class, feature_code)"}},"summary":"Look up placenames in a specific URN."}},"/reference_corpus":{"get":{"parameters":[{"default":"digibok","description":"select the doctype","enum":["digibok","digavis"],"in":"query","name":"corpus","required":true,"type":"string"},{"default":2015,"in":"query","name":"from_year","required":true,"type":"integer"},{"default":2021,"in":"query","name":"to_year","required":true,"type":"integer"},{"default":50000,"in":"query","name":"limit","type":"integer"},{"default":"nob","enum":["nob","nno","sme","sma","smj","fkv"],"in":"query","name":"lang","required":true,"type":"string"}],"responses":{"200":{"description":"A list of n words with their frequencies"}},"summary":"Reference frequency list of the n most frequent words from a given corpus in a given period."}},"/reference_words":{"post":{"consumes":["application/json"],"parameters":[{"in":"body","name":"reference_words","required":true,"schema":{"properties":{"doctype":{"description":"the document type","enum":["digibok","digavis"],"example":"digibok","type":"string"},"from_year":{"description":"minimum year of publication","example":1950,"type":"integer"},"to_year":{"description":"maximum year of publication","example":1960,"type":"integer"},"words":{"description":"the words (unigrams) to lookup","example":["Norge","demokrati","frihet"],"type":"array"}},"type":"object"}}],"responses":{"200":{"description":"a table of frequencies (first column = word, second column = absolute frequency, third column = relative frequency)"}},"summary":"Lookup a list of words in a reference corpus"}},"/totals/{top_words}":{"get":{"parameters":[{"default":50000,"in":"path","name":"top_words","required":true,"type":"integer"}],"responses":{"200":{"description":"A list of n words with their frequencies"}},"summary":"Reference frequency list"}},"/urn/{urn}":{"get":{"parameters":[{"in":"path","name":"urn","required":true,"type":"string"}],"responses":{"200":{"description":"A JSON object with metadata"}},"summary":"Returns basic metadata for a specific dhlab series URN"}},"/urn_frequencies":{"post":{"consumes":["application/json"],"parameters":[{"in":"body","name":"api_frequencies","required":true,"schema":{"properties":{"urns":{"description":"a list of URNs or DH-lab identifiers","example":["URN:NBN:no-nb_digibok_2011051112001"],"required":true,"type":"array"}},"type":"object"}}],"responses":{"200":{"description":"a document-term matrix (dtm)"}},"summary":"Get frequencies for multiple URNs"}}},"schemes":["https","http"],"swagger":"2.0"}
