Git Product home page Git Product logo

Comments (4)

AramTaravat avatar AramTaravat commented on July 23, 2024 1

I found this one :
errant_parallel -orig <orig_file> -cor <cor_file1> [<cor_file2> ...] -out <out_m2>
I think this mean that in [<cor_file2> ...] I should write other correct ones for that sentence . So for other sentences that have just one correction, what should we write in other files ? the correct sentence again or just an empty line?

from errant.

AramTaravat avatar AramTaravat commented on July 23, 2024 1

Yeah this works.
Also I tried the CLI and it worked, just it repeats the same lines of edits for sentences with one correction but with a little change it fixed.
Thank you

from errant.

chrisjbryant avatar chrisjbryant commented on July 23, 2024

Check out the readme! There are instructions on how to do that using both the CLI and the API.

from errant.

chrisjbryant avatar chrisjbryant commented on July 23, 2024

Ah, so you have a different number of suggestions for each sentence?

In that case, you could repeat the correction from <cor_file1> in the other files and it won't affect anything, but I'd instead recommend using the API. Something like:

import errant

annotator = errant.load('en')

with open("output.m2", "w") as out:
    for orig in orig_sents:
        out.write("S "+orig) # Write the tokenised orig sentence in an m2 file (preceded by S)
        orig = annotator.parse(orig)
        for i, hyp in enumerate(hyp_sents):
            hyp = annotator.parse(hyp)
            edits = annotator.annotate(orig, hyp)
            # Write the edits for each hypothesis in M2 format
            for e in edits:
                out.write(e.to_m2(i)+"\n")
        # Empty line after each orig sentence in an m2 block
        out.write("\n")

from errant.

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.