Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gatenlp/mimir-python
A client library for working with Mimir search in Python
https://github.com/gatenlp/mimir-python
Last synced: 7 days ago
JSON representation
A client library for working with Mimir search in Python
- Host: GitHub
- URL: https://github.com/gatenlp/mimir-python
- Owner: GateNLP
- License: lgpl-3.0
- Created: 2016-10-25T12:27:05.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-01T16:08:25.000Z (over 7 years ago)
- Last Synced: 2024-11-13T18:43:46.514Z (2 months ago)
- Language: Python
- Size: 7.81 KB
- Stars: 0
- Watchers: 15
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mimir-python
A client library for working with Mímir search in Python.
Supports the Mímir API as described in [the documentation for mimir](https://gate.ac.uk/mimir/doc/mimir-guide.pdf).
Also adds context helpers to deal with initialising and removing queries, and iterators to allow for more pythonic use.
```python
from mimir_helpers import MimirHelper# Configuring the endpoint. Don't forget the trailing slash.
helper = MimirHelper("http://mymimirendpoint.example.com/search/")# Issue a query manually.
queryId = helper.postQuery("{Token}")
helper.wait(queryId) # Wait until the search is done.
print helper.documentsCount(queryId)
print helper.documentId(queryId, rank=0)
helper.close(queryId) # Politely tell the server we're done with this query.# Issue a query manually using the context manager
with helper.query("{Token}") as resultSet:
print resultSet.documentsCount()
print resultSet.documentId(rank=0)# Iterate over the results from a query.
with helper.query("{Token}") as resultSet:
for result in resultSet.results():
print result.text
print result.documentId
print result.hits
print result.metadata
print result.tokens
```Depends on python requests library.
Have fun!