Coder Social home page Coder Social logo

rnc's Introduction

Kirill kunansy

Kunansy Stats

rnc's People

Contributors

kunansy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

rnc's Issues

Use ABC

Make Corpus and Example classes abstract.

Pages

Задать через класм Pages. количество страниц: ≤, все, случайная страница

Almanac

Here the are some minor changes, fixes and improvements

[ERROR] [corpora_requests:whether_result_found] The request is not correct

bug
[ERROR] [corpora_requests:whether_result_found] The request is not correct

code

    import rnc
    
    ru = rnc.MainCorpus(
        query='корпус', 
        p_count=5,
        marker=str.upper)
    
    ru.request_examples()

logs

    [28.03.2023 15:24:07,632] [DEBUG] [corpora_requests:is_request_correct] Validating that everything is OK
    [28.03.2023 15:24:07,634] [DEBUG] [corpora_requests:whether_result_found] Validating that the request is OK
    [28.03.2023 15:24:07,635] [INFO] [corpora_requests:get_htmls] Requested to 'https://processing.ruscorpora.ru/search.xml' [0;1) with params {'env': 'alpha', 'api': '1.0', 'lang': 'en', 'dpp': 5, 'spd': 10, 'text': 'lexgramm', 'out': 'normal', 'sort': 'i_grtagging', 'nodia': 1, 'lex1': 'корпус', 'mode': 'main'}
    [28.03.2023 15:24:07,636] [ERROR] [corpora_requests:whether_result_found] The request is not correct: {'env': 'alpha', 'api': '1.0', 'lang': 'en', 'dpp': 5, 'spd': 10, 'text': 'lexgramm', 'out': 'normal', 'sort': 'i_grtagging', 'nodia': 1, 'lex1': 'корпус', 'mode': 'main'}
    [28.03.2023 15:24:07,636] [ERROR] [corpora_requests:is_request_correct] HTTP request is wrong
    [28.03.2023 15:24:07,637] [ERROR] [corpora:request_examples] Query = ['корпус'], 5, {'env': 'alpha', 'api': '1.0', 'lang': 'en', 'dpp': 5, 'spd': 10, 'text': 'lexgramm', 'out': 'normal', 'sort': 'i_grtagging', 'nodia': 1, 'lex1': 'корпус', 'mode': 'main'}
    e = {'env': 'alpha', 'api': '1.0', 'lang': 'en', 'dpp': 5, 'spd': 10, 'text': 'lexgramm', 'out': 'normal', 'sort': 'i_grtagging', 'nodia': 1, 'lex1': 'корпус', 'mode': 'main'}
    Output exceeds the [size limit](command:workbench.action.openSettings?[). Open the full output data [in a text editor](command:workbench.action.openLargeOutput?df6b87e8-4758-497a-a54d-7a456297814e)
    ---------------------------------------------------------------------------
    RuntimeError                              Traceback (most recent call last)
    File ~/.conda-envs/venv2/lib/python3.8/site-packages/rnc/corpora_requests.py:200, in whether_result_found(url, **kwargs)
        199 try:
    --> 200     page_html = get_htmls(url, **kwargs)[0]
        201 except Exception:
    
    File ~/.conda-envs/venv2/lib/python3.8/site-packages/rnc/corpora_requests.py:164, in get_htmls(url, start, stop, **kwargs)
        162 coro_start = time.time()
    --> 164 html_codes = asyncio.run(
        165     get_htmls_coro(url, start, stop, **kwargs)
        166 )
        168 logger.info("Request was successfully completed")
    
    File ~/.conda-envs/venv2/lib/python3.8/asyncio/runners.py:33, in run(main, debug)
         32 if events._get_running_loop() is not None:
    ---> 33     raise RuntimeError(
         34         "asyncio.run() cannot be called from a running event loop")
         36 if not coroutines.iscoroutine(main):
    
    RuntimeError: asyncio.run() cannot be called from a running event loop
    
    During handling of the above exception, another exception occurred:
    
    RuntimeError                              Traceback (most recent call last)
    ...
    --> 294     raise WrongHTTPRequest(f"{kwargs}")
        295 logger.debug("HTTP request is correct, result found")
        297 logger.debug("Validating that the last page exists")
    
    WrongHTTPRequest: {'env': 'alpha', 'api': '1.0', 'lang': 'en', 'dpp': 5, 'spd': 10, 'text': 'lexgramm', 'out': 'normal', 'sort': 'i_grtagging', 'nodia': 1, 'lex1': 'корпус', 'mode': 'main'}

Я так понимаю с текущей версией сайта не библиотека не работает? Ошибка при обрашении к https://processing.ruscorpora.ru/search.xml

Log to file

Let the user to turn the logging to file off.

Data folder

Do not create folder 'data' while it is not demanded

More tests

Add cases when the result not found, last page doesn't exist etc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.