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:
- Line 3: create an instance of the EsRequest class with
the query set to
biology
. - Line 4: create an instance of the Mine class. Since all operations are done via this instance, creating this instance is the first required step to interact with the MINE system.
- Line 6: search for the word
biology
in MINE. To access the result, simply loop through theresponse
, 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 7. The full-text, if existed, will be accessible via hit.content
. The syntax of
the search_term
is the query string syntax.
For consecutive runs, the credentials is re-used so that users do not have to log in for every run. For more details, please check the Authentication section.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file minetext-0.6.0.tar.gz
.
File metadata
- Download URL: minetext-0.6.0.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ba365ba17c2326036e2565e7e4fdf4148c189acbe1bdf41a78181ec845a3bd9 |
|
MD5 | 6c5d54c5c41e0c8c43175c485c0cfca3 |
|
BLAKE2b-256 | 0f80b46ce2d45d841a0ef553dd54fbbaa6c5defb8ef0e723620dfb701dc7ef74 |
File details
Details for the file minetext-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: minetext-0.6.0-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1fb14dbe0e21ccfe7b6b4f6aa61bfaa24732eee9976200580f261b15af0f670 |
|
MD5 | ac8f3d3ac5b368abe93f01fdaa23708a |
|
BLAKE2b-256 | 6b9361d88370c5ab03652820c4358af4388c930831a47b73aeb04b83d51ff703 |