Git Product home page Git Product logo

errgent's Introduction

Errgent - Grammatical Error Generation Toolkit ๐Ÿค–

maven

Generate grammatical mistakes in natural language text.

Article - Errgent - Grammatical Error Generator.

Prerequisits

Before you begin, ensure you have met the following requirements:

  • You have Java 11 installed.
  • You have the necessary prerequisites for Errant4J.

Installing Errgent

Add this to the dependencies section of your pom.xml:

<dependency>
  <groupId>io.github.manzurola</groupId>
  <artifactId>errgent</artifactId>
  <version>0.3.0</version>
</dependency>

Using Errgent

To use Errgent in code, follow these steps:

// Create a spacy instance (from spaCy4j)
SpaCy spacy = SpaCy.create(CoreNLPAdapter.forEnglish());

// Instantiate a new Errgent for English
Generator errgent = Errgent.forEnglish(spacy);

// Generate a specific grammatical error in the target doc. Since a
// sentence can contain multiple errors at once, all such possible
// errors are returned.
List<GeneratedError> generatedErrors = errgent.generateErrors(
    "If I were you, I would go home.",
    GrammaticalError.REPLACEMENT_SUBJECT_VERB_AGREEMENT
);

// Print out the results. The markedText() method retrieves the
// erroneous text with the error marked by an asterisk on both sides.
// We can also access the char offsets of the error using charStart
// and charEnd methods of GeneratedError.
for (GeneratedError generatedError : generatedErrors) {
    String text = generatedError.markedText();
    System.out.printf(
        "%s, %s%n",
        text,
        generatedError.error()
    );
}

Errgent is currently available only for English.

Contributions

To contribute to Errgent, follow these steps:

  1. Fork this repository.
  2. Create a branch: git checkout -b <branch_name>.
  3. Make your changes and commit them: git commit -m '<commit_message>'
  4. Push to the original branch: git push origin <project_name>/<location>
  5. Create the pull request.

Alternatively see the GitHub documentation on creating a pull request.

Contributors

Thanks to the following people who have contributed to this project:

Contact

If you want to contact me you can reach me at [email protected].

License

This project uses the following license: MIT.

errgent's People

Contributors

dependabot[bot] avatar manzurola avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.