Skip to main content

Python client for MINE system

Project description

minetext

MINE is a collaboration project between the Niedersächsische Staats- und Universitätsbibliothek Göttingen (SUB) and the Gesellschaft für wissenschaftliche Datenverarbeitung Göttingen (GWDG) with the goal to offer a convenient platform for text analysis.

minetext is a Python package, which facilitates the interaction between Python clients and the MINE system. For other clients, REST API of MINE is the way to go.

Note: minetext only works on Python version >=3.7.

To install it, simply run

$ pip install minetext

Examples

Simple search

from minetext import EsRequest, Mine

es_request = EsRequest(search_term='biology')
mine = Mine(es_request)

response = mine.search()

for hit in response:
    print(hit.meta.score, hit.mine.dc_title)

The example above shows us how to search in MINE. It is done in 3 steps:

  1. Line 3: create an instance of the :ref:EsRequest <api_esRequest> class with the query set to biology.
  2. Line 4: create an instance of the :ref:Mine <api_mine> class. Since all operations are done via this instance, creating this instance is the first required step to interact with the MINE system.
  3. Line 6: search for the word biology in MINE. To access the result, simply loop through the response, as shown in line 8.

Get full-text

from minetext import EsRequest, Mine

# Search for all documents which have full-text
es_request = EsRequest(search_term='_exists_:content')

mine = Mine(es_request)
mine.login()

response = mine.search()

for hit in response:
    print(hit.content)

To access the full-text, authentication is required. It is done by calling the login method of the Mine class, as shown in the example above on line 5. The full-text, if existed, will be accessible via hit.content.

The syntax of the search_term is the query string syntax.

Note: the response object is an instance of the Response class from the elasticsearch-dsl package

For more information, please refer to the full documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

minetext-0.5.2.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

minetext-0.5.2-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file minetext-0.5.2.tar.gz.

File metadata

  • Download URL: minetext-0.5.2.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.13

File hashes

Hashes for minetext-0.5.2.tar.gz
Algorithm Hash digest
SHA256 703275ac6499bc7d8672b1efc64f530f9b34bdc1e861653bb9273ed8fe6bd612
MD5 4dc984f874836a33d4296d2821ca64aa
BLAKE2b-256 ed3e0fc20c3f70ae92a765cf8672ea9374c37e92831305ecc37cca3224bd9cf0

See more details on using hashes here.

Provenance

File details

Details for the file minetext-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: minetext-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.13

File hashes

Hashes for minetext-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c77206b2c121b2494ecd63273cb74b3904e1f02364673a4aa620cf05b5520276
MD5 42d85d8bd7097cf24004f2c8ba3accf0
BLAKE2b-256 0ca601dad288638b3de7a257c8bdb4bf6a341d777d24746913c8517847a5bbfc

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page