Git Product home page Git Product logo

Comments (11)

miau1 avatar miau1 commented on September 12, 2024

Could show the flags you used to initialize opus_reader?

from opustools.

gertva avatar gertva commented on September 12, 2024

My your_script.py:

import opustools_pkg
opus_reader = opustools_pkg.OpusRead(["-d", "JW300", "-s", "en", "-t", "ta", "-wm" "tmx"])
opus_reader.printPairs()

from opustools.

miau1 avatar miau1 commented on September 12, 2024

My your_script.py:

import opustools_pkg
opus_reader = opustools_pkg.OpusRead(["-d", "JW300", "-s", "en", "-t", "ta", "-wm" "tmx"])
opus_reader.printPairs()

You are missing a comma between "-wm" and "tmx", but I don't think that's causing the error here. I suspect this is an issue with Windows encoding behavior. I'll try to setup a Windows environment and see if I can replicate the error. In the meanwhile, you could try to run your script in a unix-like environment, if you have access to one.

from opustools.

gertva avatar gertva commented on September 12, 2024

from opustools.

gertva avatar gertva commented on September 12, 2024

from opustools.

miau1 avatar miau1 commented on September 12, 2024

@gertva I haven't been able to set up a Windows environment, but I changed something in the program: I now specify the encoding of the result files, which might help with your issue. Upgrade opustools_pkg to version 0.0.43, run your script again and let me know if it works.

I'll probably get my hands on a Windows machine by tomorrow, so I'll be able to do proper debugging.

from opustools.

gertva avatar gertva commented on September 12, 2024

from opustools.

miau1 avatar miau1 commented on September 12, 2024

Great, good to hear!

from opustools.

gertva avatar gertva commented on September 12, 2024

from opustools.

miau1 avatar miau1 commented on September 12, 2024

Almost, you have to include -- before the language id flags. You can also use split() to make the argument list formation a little easier like this:

opus_reader = opustools_pkg.OpusRead("-d JW300 -f -ln -s en -t ta -wm tmx -w enta.tmx --src_cld2 en 0.95 --trg_cld2 ta 0.95 --src_langid en 0.95 --trg_langid ta 0.95".split())

But for this to work, you have to create the language ids to the zip files, as they don't yet include them by default. First you need to install pycld2 and langid:

pip install pycld2
pip install langid

Then you can run a script like this to create the language ids:

from opustools_pkg.opus_langid import OpusLangid

OpusLangid("-f JW300_latest_xml_en.zip -v".split()).processFiles()
OpusLangid("-f JW300_latest_xml_ta.zip -v".split()).processFiles()

And then you can filter by language ids.

from opustools.

gertva avatar gertva commented on September 12, 2024

from opustools.

Related Issues (20)

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.