nur-packages

My NUR packages
git clone git://git.sikmir.ru/nur-packages
Log | Files | Refs | README | LICENSE

cli.patch (1247B)


      1 diff --git c/setup.py i/setup.py
      2 index 387f33e..b8d2cd0 100644
      3 --- c/setup.py
      4 +++ i/setup.py
      5 @@ -26,10 +26,13 @@ setuptools.setup(
      6      python_requires=">=3.8.0",
      7      install_requires=[
      8          "beautifulsoup4>=4.12.2",
      9 +        "click",
     10          "importlib-resources>=6.1.1;python_version<'3.9'",
     11          "pandas>=2.0.3",
     12          "requests>=2.31.0",
     13          "SQLAlchemy>=2.0.23",
     14          "tqdm>=4.66.1",
     15 +        "xdg-base-dirs",
     16      ],
     17 +    entry_points={"console_scripts": "parallel_corpus=tatoebatools.cli:parallel_corpus"},
     18  )
     19 diff --git c/tatoebatools/cli.py i/tatoebatools/cli.py
     20 new file mode 100644
     21 index 0000000..76a4ef0
     22 --- /dev/null
     23 +++ i/tatoebatools/cli.py
     24 @@ -0,0 +1,13 @@
     25 +import click
     26 +from xdg_base_dirs import xdg_data_home
     27 +from tatoebatools import ParallelCorpus, tatoeba
     28 +
     29 +tatoeba.dir = xdg_data_home() / "tatoebatools"
     30 +
     31 +@click.command(short_help="Parallel corpus")
     32 +@click.argument('source_language')
     33 +@click.argument('target_language')
     34 +@click.option('--update', type=click.BOOL, default=False)
     35 +def parallel_corpus(source_language, target_language, update):
     36 +    for sentence, translation in ParallelCorpus(source_language, target_language, update):
     37 +        print("%s\t%s" % (sentence.text, translation.text));