Skip to content

Commit

Permalink
Merge pull request #213 from NationalLibraryOfNorway/feat/add-fields-…
Browse files Browse the repository at this point in the history
…corpusbuilder

add two fields (publisher,city) to the corpus builder
  • Loading branch information
magbb authored Aug 2, 2024
2 parents 031bfe0 + 86a828d commit 5c5da3c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dhlab/api/dhlab_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,8 @@ def document_corpus(
title: str = None,
ddk: str = None,
subject: str = None,
publisher: str = None,
city: str = None,
lang: str = None,
limit: int = None,
order_by: str = None,
Expand All @@ -660,6 +662,8 @@ def document_corpus(
:param str ddk: `Dewey Decimal Classification
<https://no.wikipedia.org/wiki/Deweys_desimalklassifikasjon>`_ identifier.
:param str subject: subject (keywords) of the publication.
:param str publisher: Name of publisher.
:param str city: place of publication.
:param str lang: Language of the publication, as a 3-letter ISO code.
Example: ``"nob"`` or ``"nno"``
:param int limit: number of items to sample.
Expand Down
8 changes: 8 additions & 0 deletions dhlab/text/corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def __init__(
title=None,
ddk=None,
subject=None,
publisher=None,
city=None,
lang=None,
limit=10,
order_by="random",
Expand All @@ -65,6 +67,8 @@ def __init__(
<https://no.wikipedia.org/wiki/Deweys_desimalklassifikasjon>`\
_ identifier.
:param str subject: subject (keywords) of the publication.
:param str publisher: Name of publisher.
:param str city: place of publication.
:param str lang: Language of the publication, as a 3-letter ISO code.
Example: ``"nob"`` or ``"nno"``
:param int limit: number of items to sample.
Expand All @@ -82,6 +86,8 @@ def __init__(
or title
or ddk
or lang
or publisher
or city
):
self.corpus = document_corpus(
doctype,
Expand All @@ -95,6 +101,8 @@ def __init__(
title,
ddk,
subject,
publisher,
city,
lang,
limit,
order_by,
Expand Down

0 comments on commit 5c5da3c

Please sign in to comment.