PyJPBoatRace: Python-based Japanese boatrace tools 🚤

Overview

PyJPBoatRace: Python-based Japanese boatrace tools 🚤

GitHub top language GitHub tag (latest SemVer) GitHub GitHub last commit

Japanese boat race is extremely exciting sports. It is also fun to predict the results of races. Prediction like machine learning method requires data. Thus, this package provides you with useful tools for data analysis and auto-betting for boatrace.

Installation

Requirements

If you want to deposit, withdraw and betting with pyjpboatrace, one of the following browers is required at least:

  • Chrome
  • Firefox
  • Edge

Dependencies

  • python >= 3.7
  • requests>=2.25.0
  • beautifulsoup4>=4.9.3
  • selenium>=3.141.0
  • webdriver-manager>=3.2.2
  • msedge-selenium-tools

User installation

    pip install -U pyjpboatrace

How to use

  1. (optional) create an instance of UserInformation;
  2. (optional) create a selenium driver;
  3. create an instance of PyJPBoatrace;
  4. execute scraping and operating.

NOTE: you must create a UserInformation instance and a selenium driver to order to deposit, withdraw or bet.

UserInformation

  • pyjpboatrace.user_information.UserInformation(userid:str, pin:str, auth_pass:str, vote_pass:str, json_file:str)

NOTE: If you use a json file to create an instance of UserInformation, the json file should contain the following keys: userid, pin, auth_pass and vote_pass.

Selenium Driver

You can use the following functions to create selenium drivers:

  • pyjpboatrace.drivers.create_chrome_driver()
  • pyjpboatrace.drivers.create_firefox_driver()
  • pyjpboatrace.drivers.create_edge_driver()
  • pyjpboatrace.drivers.create_httpget_driver()

NOTE 1: you can use your own selenium driver.

NOTE 2: If you use create_httpget_driver, you cannot execute the following operations, deposit, withdraw or bet.

Scraping and Operating

PyJPBoatrace provides 2 main functions: scraping and operating.

The former is scraping race information, odds and so on; the latter is betting, depositing and withdrawing.

Scraping

  • Get a list of stadiums which hold races on the given day:

    • API:

      • PyJPBoatrace().get_stadiums(d: datetime.date) -> Dict[str, Any]
      • PyJPBoatrace().Stadiums.get(d: datetime.date) -> Dict[str, Any]
    • Return:

      Sample
      {
        "date": "2021-08-12",
        "大村":{
          "status":"-",
          "grade":[
            "ippan",
            "rookie"
          ],
          "timeframe":"nighter",
          "title":"ルーキーシリーズ第16戦 オール進入固定レース",
          "period":[
            "2020-09-07",
            "2020-09-13"
          ],
          "day":"初日"
        },
        ...
      }
  • To get 12 races held in the given stadium on the given day:

    • API:

      • PyJPBoatrace().get_12races(d: datetime.date, stadium: int) -> Dict[str, Any]
      • PyJPBoatrace().Races.get(d: datetime.date, stadium: int) -> Dict[str, Any]
    • Return:

      Sample
      {
        "date": "2021-08-12",
        "stadium": 1,
        "1R":{
            "vote_limit":"2020-01-01 10:00:00",
            "status":"発売終了",
            "racers":{
                "boat1":{
                    "name":"Name1",
                    "class":"A1"
                },
                "boat2":{
                    "name":"Name2",
                    "class":"A2"
                },
                "boat3":{
                    "name":"Name3",
                    "class":"B1"
                },
                "boat4":{
                    "name":"Name4",
                    "class":"B2"
                },
                "boat5":{
                    "name":"Name5",
                    "class":"A1"
                },
                "boat6":{
                    "name":"Name6",
                    "class":"B1"
                }
            }
        },
        ...,
        "12R":{
            "vote_limit":"2020-01-01 15:30:00",
            "status":"発売終了",
            "racers":{
                "boat1":{
                    "name":"Name1",
                    "class":"A1"
                },
                "boat2":{
                    "name":"Name2",
                    "class":"A2"
                },
                "boat3":{
                    "name":"Name3",
                    "class":"B1"
                },
                "boat4":{
                    "name":"Name4",
                    "class":"B2"
                },
                "boat5":{
                    "name":"Name5",
                    "class":"A1"
                },
                "boat6":{
                    "name":"Name6",
                    "class":"B1"
                }
            }
        }
      }
  • To get the basic information of the race in the stadium on a day:

    • API:

      • PyJPBoatrace().get_race_info(d: datetime.date, stadium: int, race: int) -> Dict[str, Any]
      • PyJPBoatrace().RaceInfo.get(d: datetime.date, stadium: int, race: int) -> Dict[str, Any]
    • Return:

      Sample
      {
        "date": "2021-08-12",
        "stadium": 10,
        "race": 1,
        "boat1": {
          "racerid": 9999,
          "class": "A1",
          "name": "Name1",
          "branch": "Somewhere",
          "birthplace": "Somewhere",
          "age": 40,
          "weight": 53.2,
          "F": 0,
          "L": 0,
          "aveST": 0.19,
          "global_win_pt": 6.43,
          "global_in2nd": 43.86,
          "global_in3rd": 68.42,
          "local_win_pt": 0,
          "local_in2nd": 0,
          "local_in3rd": 0,
          "motor": 42,
          "motor_in2nd": 35.48,
          "motor_in3rd": 56.13,
          "boat": 41,
          "boat_in2nd": 30.77,
          "boat_in3rd": 54.49,
          "result": [
            {
                "race": 8,
                "boat": 2,
                "course": 2,
                "ST": 0.24,
                "rank": 6
            },
            {},
            {
                "race": 4,
                "boat": 4,
                "course": 4,
                "ST": 0.28,
                "rank": 5
            },
            ...,
            {}
          ]
        },
        ...,
        "race_title": [
            "みくにあさガチ",
            "1800m"
        ]
      }
  • To get the odds of win (単勝) and place-show (複勝) of the race in the stadium on the day:

    • API:

      • PyJPBoatrace().get_odds_win_placeshow(d: datetime.date, stadium: int, race: int) -> Dict[str, Any]
      • PyJPBoatrace().WinPlaceshowOdds.get(d: datetime.date, stadium: int, race: int) -> Dict[str, Any]
    • Return:

      Sample
      {
        "date": "2020-10-24",
        "stadium": 14,
        "race": 1,
        "win":{
          "1": 1.0,
          "2": 6.8,
          "3": 9.3,
          "4": 41.3,
          "5": 36.1,
          "6": 72.3
        },
        "place_show":{
          "1": [1.0, 1.3],
          "2": [3.3, 5.0],
          "3": [1.5, 2.2],
          "4": [5.7, 8.9],
          "5": [1.1, 1.6],
          "6": [22.0, 33.3]
        },
        "update": "締切時オッズ"
      }
  • To get the odds of quinella place (拡連複) of the race in the stadioum on the day:

    • API:

      • PyJPBoatrace().get_odds_quinellaplace(d: datetime.date, stadium: int, race: int) -> Dict[str, Any]
      • PyJPBoatrace().QuinellaplaceOdds.get(d: datetime.date, stadium: int, race: int) -> Dict[str, Any]
    • Return:

      Sample
      {
        "date": "2020-10-24",
        "stadium": 14,
        "race": 1,
        "1=2": [1.2,1.4],
        "1=3": [1.3,1.8],
        ...,
        "5=6": [27.2,30.9],
        "update": "9:02"
      }
  • To get the odds of exacta (二連単) and quinella (二連複) of the race in the stadioum on the day:

    • API:

      • PyJPBoatrace().get_odds_exacta_quinella(d: datetime.date, stadium: int, race: int) -> Dict[str, Any]
      • PyJPBoatrace().ExactaQuinellaOdds.get(d: datetime.date, stadium: int, race: int) -> Dict[str, Any]
    • Return:

      Sample
      {
        "date": "2020-10-24",
        "stadium": 14,
        "race": 1,
        "exacta":{
          "1-2": 2.5,
          "1-3": 2.8,
          ...,
          "6-5": 2931.0
        },
        "quinella":{
          "1=2": 3.0,
          "1=3": 2.1,
          ...,
          "5=6": 298.3
        },
        "update": "12:30"
      }
  • To get the odds of trifecta (三連単) of the race in the stadioum on the day:

    • API:

      • PyJPBoatrace().get_odds_trifecta(d: datetime.date, stadium: int, race: int) -> Dict[str, Any]
      • PyJPBaotrace().TrifectaOdds.get(d: datetime.date, stadium: int, race: int) -> Dict[str, Any]
    • Return:

      Sample
      {
        "date": "2020-10-24",
        "stadium": 14,
        "race": 1,
        "1-2-3": 5.6,
        "1-2-4": 14.4,
        ...,
        "6-5-4": 8650.0,
        "update": "締切時オッズ"
      }
  • To get the oods of trio (三連複) of the race in the stadioum on the day:

    • API:

      • PyJPBoatrace().get_odds_trio(d: datetime.date, stadium: int, race: int) -> Dict[str, Any]
      • PyJPBoatrace().Trio.get(d: datetime.date, stadium: int, race: int) -> Dict[str, Any]
    • Return:

      Sample
      {
        "date": "2020-10-24",
        "stadium": 14,
        "race": 1,
        "1=2=3": "欠場",
        "1=2=4": "欠場",
        "1=2=5": "欠場",
        "1=2=6": "欠場",
        "1=3=4": "欠場",
        "2=3=4": 4.2,
        "1=3=5": "欠場",
        "2=3=5": 30,
        "1=3=6": "欠場",
        "2=3=6": 2.3,
        "1=4=5": "欠場",
        "2=4=5": 25,
        "3=4=5": 79.2,
        "1=4=6": "欠場",
        "2=4=6": 1.9,
        "3=4=6": 60,
        "1=5=6": "欠場",
        "2=5=6": 26.7,
        "3=5=6": 132.1,
        "4=5=6": 90.1,
        "update": "15:30"
      }
  • To get the just-before information, e.g. weather and start-timing, of the race in the stadioum on the day:

    • API:

      • PyJPBoatrace().get_just_before_info(d: datetime.date, stadium: int, race: int) -> Dict[str, Any]
      • PyJPBoatrace().JustBeforeInfo.get(d: datetime.date, stadium: int, race: int) -> Dict[str, Any]
    • Return:

      Sample
      {
        "date": "2020-08-25",
        "stadium": 14,
        "race": 7,
        "boat1":{
            "name":"Name1",
            "weight":55.1,
            "weight_adjustment":0.0,
            "display_time":6.87,
            "tilt":0.0,
            "propeller":"",
            "parts_exchange":[
                "リング×1",
                "シャフト"
            ],
            "previous_race":{}
        },
        ...,
        "boat6":{
            "name":"Name6",
            "weight":51.0,
            "weight_adjustment":0.0,
            "display_time":6.88,
            "tilt":-0.5,
            "propeller":"",
            "parts_exchange":[],
            "previous_race":{
                "race":3,
                "boat":3,
                "course":3,
                "ST":0.13,
                "rank":6
            }
        },
        "start_display":{
            "course1":{
                "boat":1,
                "ST":0.02
            },
            ...,
            "course6":{
                "boat":6,
                "ST":0.10
            }
        },
        "weather_information":{
            "direction":16,
            "weather":"晴",
            "temperature":31.0,
            "wind_direction":14,
            "wind_speed":5,
            "water_temperature":27.0,
            "wave_height":5,
            "time":"6R時点"
        }
      }
  • To get the race result of the race in the stadioum on the day:

    • API:

      • PyJPBoatrace().get_race_result(d: datetime.date, stadium: int, race: int) -> Dict[str, Any]
      • PyJPBoatrace().Result.get(d: datetime.date, stadium: int, race: int) -> Dict[str, Any]
    • Return:

      Sample
      {
        "date": "2020-10-24",
        "stadium": 14,
        "race": 1,
        "result":[
            {
                "rank":1,
                "boat":1,
                "name":"WHO1",
                "racerid":9999,
                "time":"1'50\"0"
            },
            ...,
            {
                "rank":6,
                "boat":2,
                "name":"WHO6",
                "racerid":8888,
                "time":""
            }
        ],
        "kimarite":"逃げ",
        "start_information":{
            "course1":{
                "boat":1,
                "ST":0.05
            },
            ...,
            "course6":{
                "boat":6,
                "ST":0.11
            }
        },
        "payoff":{
            "trifecta":{
                "result":"1-5-6",
                "payoff":12345,
                "popularity":34
            },
            ...,
            "quinella_place":[
                {
                    "result":"1=5",
                    "payoff":220,
                    "popularity":3
                },
                ...
            ],
            ...,
        },
        "weather_information":{
            "direction":16,
            "weather":"晴",
            "temperature":17.0,
            "wind_direction":6,
            "wind_speed":5,
            "water_temperature":21.0,
            "wave_height":5
        },
        "return":[],
        "note":[]
      }

These functions return dict object.

Operations

  • To deposit money for betting (Unit: 1,000 yen):

    • API
      • PyJPBoatrace().deposit(num_of_thousands_yen: int) -> None
      • PyJPBoatrace().Deposit.do(num_of_thousands_yen: int) -> None
    • Return:
      • Nothing
  • To get the limit of betting amount, that is, your current deposit:

    • API
      • PyJPBoatrace().get_bet_limit() -> int
      • PyJPBoatrace().BettingLimitCheck.do() -> int
    • Return:
      • int: the amount of deposit
  • To withdraw your current deposit:

    • API:

      • PyJPBoatrace().withdraw() -> None
      • PyJPBoatrace().Widthdraw.do() -> None
    • Return:

      • Nothing
  • To bet some tickets.

    • API:

      • PyJPBoatrace().bet(
          stadium:int,
          race:int,
          trifecta_betting_dict: Dict[str, int],
          trio_betting_dict: Dict[str, int],
          exacta_betting_dict: Dict[str, int],
          quinela_betting_dict: Dict[str, int],
          quinellaplace_betting_dict: Dict[str, int],
          win_betting_dict: Dict[str, int],
          placeshow_betting_dict: Dict[str, int],
        ) -> bool
      • PyJPBoatrace().Bet.do(
          stadium:int,
          race:int,
          trifecta_betting_dict: Dict[str, int],
          trio_betting_dict: Dict[str, int],
          exacta_betting_dict: Dict[str, int],
          quinela_betting_dict: Dict[str, int],
          quinellaplace_betting_dict: Dict[str, int],
          win_betting_dict: Dict[str, int],
          placeshow_betting_dict: Dict[str, int],
        ) -> bool
    • Each dictionary consits of pairs of winning numbers and betting amount, e.g., {'1-2-3':100} for trifecta_betting_dict

IMPORTANT NOTE: you must give a driver other than HTTPGetDriver to use above actions.

Demo

Demo 1 : Getting odds data

The following example is useful. Suppose that you want get the odds of trifecta of 4th race in stadium "桐生" on 2020/12/02 and dump the result into data.json.

from datetime import date
import json
from pyjpboatrace import PyJPBoatrace

# initialize
boatrace_tools = PyJPBoatrace()

# get data
dic = boatrace_tools.get_odds_trifecta(d=date(2020,12,2), stadium=1, race=4)

# dump data
with open('data.json', 'w', encoding='utf-8') as f:
    json.dump(dic, f, ensure_ascii=False)

# close (you can use 'with' statement)
boatrace_tools.close()

You can get many kinds of data as this example.

Demo 2 : Betting

Suppose it is 2020/12/02 and you want to bet 200 yen on trifecta 1-3-4 and 100 yen on trio 1=3=4 in the 2nd race in stadium "桐生" on 2020/12/02. NOTE: you need google chrome in the following example.

from datetime import date
from pyjpboatrace import PyJPBoatrace
from pyjpboatrace.drivers import create_chrome_driver
from pyjpboatrace.const import STADIUMS_MAP
from pyjpboatrace.user_information import UserInformation

# initialize
user = UserInformation(
    userid='YOUR_USER_ID',
    pin='YOUR_PIN',
    auth_pass='YOUR_AUTHENTIFICATION_PASSWORD',
    vote_pass='YOUR_BETTING_PASSWORD',
)
boatrace_tools = PyJPBoatrace(
    driver=create_chrome_driver(),
    user_information=user
)

# deposit 1,000 yen
boatrace_tools.deposit(1)

# bet
stadium = {s:i for i,s in STADIUMS_MAP}.get("桐生")
race = 2
boatrace_tools.bet(
    stadium=stadium,
    race=race,
    trifecta_betting_dict={'1-3-4':200},
    trio_betting_dict={'1=3=4':100}
)

# waiting for the race result ...

# withdraw
boatrace_tools.withdraw()

# close (you can use 'with' statement)
boatrace_tools.close()

NOTE

The map between integers and stadiums is given by STADIUMS_MAP in pyjpboatrace.const.

Contribution Guide

Requirement

  • Python >= 3.7
  • Pipenv (You can install pipenv by pip install pipenv)
  • Chrome
  • Firefox
  • bash
  • curl

Issues

  • For any bugs, use BUG REPORT to create an issue.

  • For any enhancement, use FEATURE REQUEST to create an issue.

  • For other topics, create an issue with a clear and concise description.

Pull Request

  1. Fork (https://github.com/hmasdev/pyjpboatrace/fork);
  2. Create your feature branch (git checkout -b feautre/xxxx);
  3. Test codes according to Test Subsection;
  4. Commit your changes (git commit -am 'Add xxxx feature);
  5. Push to the branch (git push origin feature/xxxx);
  6. Create new Pull Request

Test

You can do unit tests and integration tests as follows:

$ ./download_html_for_test.sh  # Only 1 time
$ pipenv run pytest -m "not integrate and not spending_money" # unit tests
$ pipenv run pytest  # unit tests and integration tests

pipenv run pytest does not test depositing, withdrawing or betting. If you want to test them, make .secrets.json at first:

{
  "userid": "YOUR_USER_ID",
  "pin": "YOUR_PIN",
  "auth_pass": "YOUR_AUTHENTIFICATION_PASSWORD",
  "vote_pass": "YOUR_BETTING_PASSWORD"
}

Then, run

$ pipenv run pytest -m "spending_money"

WARNING: Tests with spending_money spend 700 yen.

LICENSE

MIT

Authors

hmasdev

Comments
  • [BUG] Scheduled tests failed for stadiums, race_info and just_before_info scrapers

    [BUG] Scheduled tests failed for stadiums, race_info and just_before_info scrapers

    Describe the bug

    Pytest failed.

    Environment

    • github actions (See https://github.com/hmasdev/pyjpboatrace/actions/runs/1766385345)
    • Python Version: 3.7, 3.8 and 3.9

    To Reproduce

    I have confirmed that the following test fails in my environment as well:

    $ pipenv install --dev
    $ ./download_html_for_test.sh
    $ pipenv run pytest
    

    Screenshots or codes

    See https://github.com/hmasdev/pyjpboatrace/actions/runs/1938733501

    Expected behavior

    The test should pass.

    Problems

    Reasons (Optional)

    TBD

    bug 
    opened by hmasdev 3
  • [BUG] PyPI workflow in actions does not work

    [BUG] PyPI workflow in actions does not work

    Describe the bug

    PyPI workflow in actions, which runs when released, returns exit code 1 during uploading .whl and .tar.gz with twine.

    https://github.com/hmasdev/pyjpboatrace/actions/runs/1103843756

    Environment

    • OS: Ubuntu 20.04.2 LTS
    • Python Version: 3.7.11 (actions/setup-python@v1)

    To Reproduce (Probabily)

    Steps to reproduce the behavior:

    1. Go to https://github.com/hmasdev/pyjpboatrace/releases
    2. Click on "Draft a new release"
    3. Input tag version, title and description.
    4. Click on "Publish release", which triggers PyPI workflow.
    5. Error during PyPI workflow in Upload step as follows:
      Traceback (most recent call last):
         File "/home/runner/.local/share/virtualenvs/pyjpboatrace-cg8vEFYy/bin/twine", line 5, in <module>
           from twine.__main__ import main
         File "/home/runner/.local/share/virtualenvs/pyjpboatrace-cg8vEFYy/lib/python3.8/site-packages/twine/__init__.py", line 27, in <module>
           import importlib_metadata
      ModuleNotFoundError: No module named 'importlib_metadata'
      Error: Process completed with exit code 1.
      

    Expected behavior

    Twine succeeds in uploading .whl and .tar.gz to pypi server.

    Uploading distributions to https://upload.pypi.org/legacy/
    Uploading pyjpboatrace-0.2.0-py3-none-any.whl
    100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 63.5k/63.5k [00:02<00:00, 24.2kB/s]
    Uploading pyjpboatrace-0.2.0.tar.gz
    100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 50.3k/50.3k [00:01<00:00, 31.2kB/s] 
    
    View at:
    https://pypi.org/project/pyjpboatrace/0.2.0/
    

    Problems

    If this bug is not fixed, we can not upload this package to pypi automatically, that is, manual operation is required when uploading.

    Reasons (Optional)

    Checking the log, I found pipenv uses python 3.8.10 as follows:

    Creating a virtualenv for this project...
    Pipfile: /home/runner/work/pyjpboatrace/pyjpboatrace/Pipfile
    Using /usr/bin/python3.8 (3.8.10) to create virtualenv...
    created virtual environment CPython3.8.10.final.0-64 in 694ms
    

    This is probably a reason for this bug.

    See https://stackoverflow.com/a/59734959/16567832

    bug 
    opened by hmasdev 2
  • [BUG] If grade is SG, parsing fails.

    [BUG] If grade is SG, parsing fails.

    If grade is SG, parsing fails. https://www.boatrace.jp/owpc/pc/race/index?hd=20221030

    from datetime import date
    import json
    from pyjpboatrace import PyJPBoatrace
    boatrace_tools = PyJPBoatrace()
    dic = boatrace_tools.get_stadiums(d=date(2022,10,30))
    with open('data.json', 'w', encoding='utf-8') as f:
        json.dump(dic, f, ensure_ascii=False)
    boatrace_tools.close()
    

    ... 'Always': {'status': '-', 'grade': ['[FailedToParse]is-SGa'], 'timeframe': '', 'title': 'The 69th Boat Race Derby', 'period': ['2022-10-25', '2022-10-30'], 'day': 'Last day'}, ...

    bug 
    opened by miyamamoto 1
  • Add timestamp to the responses from odds scrapers

    Add timestamp to the responses from odds scrapers

    Abstract

    The response dictionaries from odds scrapers, like get_odds_trifecta (TrifectaOddsScraper.get), should contain the timestamp when odds number are updated.

    AsIs: Background

    Odds scrapers for a race return the final odds after the race is over. However, they return uncertain odds before the race is not over.

    The numbers varies depending on when the scrapers are called. For example, get_odds_trifecta returns one-min-ahead trifecta odds when you call get_odds_trifecta one minute before the deadline. On the other hand, it returns five-min-ahead trifecta odds when you call get_odds_trifecta five minutes before the deadline. The problem is that you can not find the timestamp when odds have been updated in the reponse from the scraper.

    The following is an example:

    from datetime import date, datetime
    import json
    from pyjpboatrace import PyJPBoatrace
    
    # initialize
    boatrace_tools = PyJPBoatrace()
    
    # get data
    d=date(2020,12,2)
    stadium=1
    race=4
    timestamp = datetime.now()
    response = boatrace_tools.get_odds_trifecta(d=d, stadium=stadium, race=race)
    
    # add timestamp to response
    # because response is a dictionary like {"1-2-3": 7.0, ..., "6-5-4": 9999}
    response["timestamp"] = timestamp
    
    # close (you can use 'with' statement)
    boatrace_tools.close()
    

    ToBe: Describe the solution you'd like

    I want odds scrapers to response the timestamp in addition to odds values. Altanatively, I want odds scrapers to scrape the update timestamp from the target website, because odds pages in pyjpboatrace.jp contain a timestamp when the odds are updated.

    enhancement 
    opened by hmasdev 1
  • Add arguments (date, stadium and race) to response dictionary

    Add arguments (date, stadium and race) to response dictionary

    Abstract

    The response dictionaries from scraping functions e.g. get_stadiums (StadiumsScraper.get) and get_odds_trifecta (TrifectaOddsScraper.get), should contain the arguments: date, stadium number and race number.

    AsIs: Background

    A use case of pyjpboatrace is to use pyjpboatrace scrapers to create boatrace database, where date, stadium number and race number are likely to be primary keys. However, the response dictionaries from scraping functions don't contain the arguments, so it is required to add the arguments, like date, stadium number and race number, to the response dictionaries after scraping.

    The following is an example:

    from datetime import date
    import json
    from pyjpboatrace import PyJPBoatrace
    
    # initialize
    boatrace_tools = PyJPBoatrace()
    
    # get data
    d=date(2020,12,2)
    stadium=1
    race=4
    response = boatrace_tools.get_odds_trifecta(d=d, stadium=stadium, race=race)
    
    # add date, stadium and race to response
    # because response is a dictionary like {"1-2-3": 7.0, ..., "6-5-4": 9999}
    response["date"] = d
    response["stadium"] = stadium
    response["race"] = race
    
    # close (you can use 'with' statement)
    boatrace_tools.close()
    

    ToBe: Describe the solution you'd like

    I want the response dictionaries from pyjpboatrace's scrapers to contain the arugments like date, stadium number and race number. For example, the reponse from get_odds_trifecta should be like

    {
      "date": date(2020, 1, 1),  # This is a new element.
      "stadium": 1,    # This is a new element.
      "race": 1,    # This is a new element.
      "1-2-3": 5.6,
      "1-2-4": 14.4,
      ...,
      "6-5-4": 8650.0
    }
    
    enhancement 
    opened by hmasdev 1
  • すべての選手がフライングだった際のget_race_resultのエラーについて

    すべての選手がフライングだった際のget_race_resultのエラーについて

    すべての選手がフライングだった際においてget_race_resultがエラーを吐く様子です。 https://www.boatrace.jp/owpc/pc/race/raceresult?rno=3&jcd=21&hd=20180101

    dic = boatrace_tools.get_race_result(d=date(2018,1,1), stadium=21, race=3)
    
    bug 
    opened by miyamamoto 1
  • Feature/update readme

    Feature/update readme

    Abstract

    Update output samples and add a note of get_race_result in README.md

    Objective

    • output samples are outdated;

    Type of change

    • Documentation update

    What you did

    • transformed output samples to python codes;
    • added a note of get_race_result
    opened by hmasdev 0
  • fix a bug in parse_html_index during parsing SG

    fix a bug in parse_html_index during parsing SG

    Abstract

    Fix codes for #64

    Objective

    To fix parsers even when grade is SG.

    Type of change

    • Bug fix (non-breaking change which fixes an issue)

    What you did

    • Fixed parsers.

    Impacts

    • When using PyJPBoatrace.get_stadiums, the grade is correctly parsed even when the grade is SG.
      • AsIs: the grade is parsed as "[FailedToParse]is-SGa" when the grade is SG;
      • ToBe: the grade is parsed as "SG" when the grade is SG.
    opened by hmasdev 0
  • Feature/add test case for multiple results

    Feature/add test case for multiple results

    Abstract

    Add test cases for #60

    Objective

    To test the api to get the result of a race where a tie occurred.

    Type of change

    • [o] Bug fix (non-breaking change which fixes an issue)

    What you did

    • [o] what you did;
      • add tests
    opened by hmasdev 0
  • Update setup.cfg

    Update setup.cfg

    Abstract

    Update setup.cfg with adding python 3.10 to classifiers

    Objective

    To indicate that it can be used in a Python 3.10 environment.

    Type of change

    Update setup.cfg

    What you did

    • Add python 3.10 to classifiers

    Operation check

    • To check whether python 3.10 is added appropriately to classifiers
    opened by hmasdev 0
  • add python 3.10 to pytest.yaml

    add python 3.10 to pytest.yaml

    Abstract

    Add test with python 3.10 to pytest.yaml

    Objective

    To test pyjpboatrace with python 3.10 in addition to python 3.7, python 3.8 and python 3.9.

    Type of change

    Update github actions

    What you did

    • Add test with python 3.10 to pytest.yaml

    Operation check

    • To check whether the tests in github actions pass
    opened by hmasdev 0
  • Request to automate updates to README.md.

    Request to automate updates to README.md.

    Abstract

    Request to automate updates to README.md.

    AsIs: Background

    The current README.md contains the PyJPBoatrace API specifications and sample output. However, when changes are made to the code, especially when there are updates to the output of each API, the sample output must be obtained manually and the README.md updated.

    ToBe: Describe the solution you'd like

    If there are updates to the output of each API, the sample output updates in README.md are automatically committed to the main branch when the corresponding pull request is merged into the main branch.

    Additional context

    • Step.1: to add a script to use the current code to update sample outputs;
    • Step.2: to create a workflow to execute the script above to update README.md and commit the change to main.

    MEMO

    This problem because apparent in https://github.com/hmasdev/pyjpboatrace/pull/61#issuecomment-1304954123

    enhancement 
    opened by hmasdev 0
Releases(v0.2.3a)
  • v0.2.3a(Dec 4, 2022)

    What's Changed

    • add python 3.10 to pytest.yaml by @hmasdev in https://github.com/hmasdev/pyjpboatrace/pull/58
    • Update setup.cfg by @hmasdev in https://github.com/hmasdev/pyjpboatrace/pull/59
    • Fixed to take multiple results when ties exist by @miyamamoto in https://github.com/hmasdev/pyjpboatrace/pull/61
    • Feature/add test case for multiple results by @hmasdev in https://github.com/hmasdev/pyjpboatrace/pull/62
    • fix a bug in parse_html_index during parsing SG by @hmasdev in https://github.com/hmasdev/pyjpboatrace/pull/65
    • Feature/update readme by @hmasdev in https://github.com/hmasdev/pyjpboatrace/pull/66

    New Contributors

    • @miyamamoto made their first contribution in https://github.com/hmasdev/pyjpboatrace/pull/61

    Full Changelog: https://github.com/hmasdev/pyjpboatrace/compare/v0.2.2a...v0.2.3a

    Source code(tar.gz)
    Source code(zip)
  • v0.2.2a(Mar 9, 2022)

  • v0.2.1a(Aug 12, 2021)

    • Add the timestamp when odds are updated to responses from odds scraper, like PyJPBoatrace.get_odds_trifecta and PyJPBoatrace.TrifectaOdds.get;
    • Add date, stadium and race to responses.
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0a(Aug 6, 2021)

  • v0.1.0a(Dec 28, 2020)

  • v0.0.0a(Dec 5, 2020)

Owner
null
Analyse japanese ebooks using MeCab to determine the difficulty level for japanese learners

japanese-ebook-analysis This aim of this project is to make analysing the contents of a japanese ebook easy and streamline the process for non-technic

Christoffer Aakre 14 Jul 23, 2022
Yomichad - a Japanese pop-up dictionary that can display readings and English definitions of Japanese words

Yomichad is a Japanese pop-up dictionary that can display readings and English definitions of Japanese words, kanji, and optionally named entities. It is similar to yomichan, 10ten, and rikaikun in spirit, but targets qutebrowser.

Jonas Belouadi 7 Nov 7, 2022
A Japanese tokenizer based on recurrent neural networks

Nagisa is a python module for Japanese word segmentation/POS-tagging. It is designed to be a simple and easy-to-use tool. This tool has the following

null 325 Jan 5, 2023
Code for producing Japanese GPT-2 provided by rinna Co., Ltd.

japanese-gpt2 This repository provides the code for training Japanese GPT-2 models. This code has been used for producing japanese-gpt2-medium release

rinna Co.,Ltd. 491 Jan 7, 2023
Sentence boundary disambiguation tool for Japanese texts (日本語文境界判定器)

Bunkai Bunkai is a sentence boundary (SB) disambiguation tool for Japanese texts. Quick Start $ pip install bunkai $ echo -e '宿を予約しました♪!まだ2ヶ月も先だけど。早すぎ

Megagon Labs 160 Dec 23, 2022
A fast Text-to-Speech (TTS) model. Work well for English, Mandarin/Chinese, Japanese, Korean, Russian and Tibetan (so far). 快速语音合成模型,适用于英语、普通话/中文、日语、韩语、俄语和藏语(当前已测试)。

简体中文 | English 并行语音合成 [TOC] 新进展 2021/04/20 合并 wavegan 分支到 main 主分支,删除 wavegan 分支! 2021/04/13 创建 encoder 分支用于开发语音风格迁移模块! 2021/04/13 softdtw 分支 支持使用 Sof

Atomicoo 161 Dec 19, 2022
Japanese synonym library

chikkarpy chikkarpyはchikkarのPython版です。 chikkarpy is a Python version of chikkar. chikkarpy は Sudachi 同義語辞書を利用し、SudachiPyの出力に同義語展開を追加するために開発されたライブラリです。

Works Applications 48 Dec 14, 2022
AllenNLP integration for Shiba: Japanese CANINE model

Allennlp Integration for Shiba allennlp-shiab-model is a Python library that provides AllenNLP integration for shiba-model. SHIBA is an approximate re

Shunsuke KITADA 12 Feb 16, 2022
Codes to pre-train Japanese T5 models

t5-japanese Codes to pre-train a T5 (Text-to-Text Transfer Transformer) model pre-trained on Japanese web texts. The model is available at https://hug

Megagon Labs 37 Dec 25, 2022
Auto translate textbox from Japanese to English or Indonesia

priconne-auto-translate Auto translate textbox from Japanese to English or Indonesia How to use Install python first, Anaconda is recommended Install

Aji Priyo Wibowo 5 Aug 25, 2022
Code for evaluating Japanese pretrained models provided by NTT Ltd.

japanese-dialog-transformers 日本語の説明文はこちら This repository provides the information necessary to evaluate the Japanese Transformer Encoder-decoder dialo

NTT Communication Science Laboratories 216 Dec 22, 2022
Script to download some free japanese lessons in portuguse from NHK

Nihongo_nhk This is a script to download some free japanese lessons in portuguese from NHK. It can be executed by installing the packages with: pip in

Matheus Alves 2 Jan 6, 2022
An open collection of annotated voices in Japanese language

声庭 (Koniwa): オープンな日本語音声とアノテーションのコレクション Koniwa (声庭): An open collection of annotated voices in Japanese language 概要 Koniwa(声庭)は利用・修正・再配布が自由でオープンな音声とアノテ

Koniwa project 32 Dec 14, 2022
Japanese Long-Unit-Word Tokenizer with RemBertTokenizerFast of Transformers

Japanese-LUW-Tokenizer Japanese Long-Unit-Word (国語研長単位) Tokenizer for Transformers based on 青空文庫 Basic Usage >>> from transformers import RemBertToken

Koichi Yasuoka 3 Dec 22, 2021
aMLP Transformer Model for Japanese

aMLP-japanese Japanese aMLP Pretrained Model aMLPとは、Liu, Daiらが提案する、Transformerモデルです。 ざっくりというと、BERTの代わりに使えて、より性能の良いモデルです。 詳しい解説は、こちらの記事などを参考にしてください。 この

tanreinama 13 Aug 11, 2022
This repository has a implementations of data augmentation for NLP for Japanese.

daaja This repository has a implementations of data augmentation for NLP for Japanese: EDA: Easy Data Augmentation Techniques for Boosting Performance

Koga Kobayashi 60 Nov 11, 2022
Grading tools for Advanced NLP (11-711)Grading tools for Advanced NLP (11-711)

Grading tools for Advanced NLP (11-711) Installation You'll need docker and unzip to use this repo. For docker, visit the official guide to get starte

Hao Zhu 2 Sep 27, 2022
HuggingSound: A toolkit for speech-related tasks based on HuggingFace's tools

HuggingSound HuggingSound: A toolkit for speech-related tasks based on HuggingFace's tools. I have no intention of building a very complex tool here.

Jonatas Grosman 247 Dec 26, 2022