Skip to main content

Library for searching answers to school questions.

Project description

RuOtvet

Library for searching answers to school questions in the big count of services.

Installation:

Download library using pip
$ pip3 install ruotvet -U

Usage examples:

Query with attachment saving example:
from ruotvet.utils import get_attachment
from ruotvet import YandexQ
import asyncio


async def main():
    questions = await YandexQ().get_answers("Что такое математика", count=1)
    for question in questions:
        print("Answer: ", question.answer)
        if question.attachments:
            print("Answer attachment: ", await get_attachment(attachment=question.attachments[0]))


loop = asyncio.get_event_loop()
loop.run_until_complete(main())

Image OCR example:

Before using OCR you need to install our sub-package for recognition and tesseract with language data for it.

Install our subpackage:

$ pip3 install ruotvet[ocr]

.. and after that install tesseract:

In macOS simply install it using brew:

$ brew install tesseract
$ brew install tesseract-lang

In unix-like you should do it like this:

$ sudo apt-get install tesseract-ocr
$ sudo apt-get install tesseract-ocr-all

For using OCR in Windows, follow this instruction.

from ruotvet.utils import OCR
from ruotvet import YandexQ
import asyncio


async def main():
    query = OCR().recognize("image.png")["text"]
    questions = await YandexQ().get_answers(query, count=1)
    for question in questions:
        print("Answer: ", question.answer)


loop = asyncio.get_event_loop()
loop.run_until_complete(main())

License

The library is under the GNU LGPLv3 license.

BE AWARE THAT THE AUTHORS ARE UNDER NO CIRCUMSTANCES RESPONSIBLE FOR CONSEQUENCES OF USE AND ANY INTERACTION WITH THE LIBRARY. NOT LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE CODE IS PROVIDED FOR EDUCATION PURPOSES ONLY.

Read the LICENSE for more information.

Contributing

Feel free to contribute.

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

ruotvet-1.3.1.1.tar.gz (10.8 kB view hashes)

Uploaded Source

Built Distribution

ruotvet-1.3.1.1-py3-none-any.whl (18.1 kB view hashes)

Uploaded Python 3

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