From 2c91a83da3e4c1607399d8e36b1c073bf8cabc0e Mon Sep 17 00:00:00 2001 From: Rakshit Khajuria Date: Wed, 9 Aug 2023 11:54:47 +0530 Subject: [PATCH 1/6] Docs: Added Contribution Guidelines --- CONTRIBUTING.md | 88 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..2bf50d208 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,88 @@ +# Contributing to LangTest + +Thank you for your interest in contributing to LangTest! We value the contributions of our community members and are excited to have you on board. To ensure a smooth and collaborative development process, please follow these guidelines: + +## Finding an Issue + +1. **Explore Our Issues:** +Browse through our list of open issues on the [Issues tab](https://github.com/YourUsername/LangTest/issues). These issues cover a wide range of topics and difficulties. You might find something that aligns with your skills and interests. + +2. **Filter and Search:** +Use the provided labels and filters to narrow down the list of issues. You can filter by tags like `feature`, `bug`, `fix`, etc. Also, utilize the GitHub search bar to look for keywords related to your expertise. + +3. **Read and Understand:** +Once you've found an issue that captures your attention, take a moment to thoroughly read and understand it. Make sure you comprehend the problem, the expected solution, and any existing discussion around it. + +4. **Clarify Doubts:** +If you have any questions or need further clarification, don't hesitate to comment on the issue. Our community is friendly and always willing to help. It's better to seek clarity before diving in. + +5. **Claim the Issue:** +If you feel confident about tackling the issue, leave a comment expressing your intention to work on it. This prevents duplication of efforts and allows us to provide guidance if needed. + +6. **Understand Contribution Guidelines:** +Familiarize yourself with our [Contribution Guidelines](https://github.com/JohnSnowLabs/langtest/wiki). This document outlines coding standards, pull request procedures, and other important details. + +## Contribution Process + +fork this repository + +1. ### Fork this repository + +Fork this repository by clicking on the fork button on the top of this page. +This will create a copy of this repository in your account. + +2. ### Clone the repository + +clone this repository + +Now clone the forked repository to your machine. Go to your GitHub account, open the forked repository, click on the code button and then click the _copy to clipboard_ icon. + +Open a terminal and run the following git command: + +``` +git clone "url you just copied" +``` + +where "url you just copied" (without the quotation marks) is the url to this repository (your fork of this project). See the previous steps to obtain the url. + +copy URL to clipboard + +For example: + +``` +git clone https://github.com/username/langtest.git +``` + +where `username` is your GitHub username. + +3. ### Create a branch + +Change to the repository directory on your computer (if you are not already there): + +``` +cd langtest +``` + +Now create a branch using the `git checkout -b` command: + +``` +git checkout -b your-branch-name +``` + +4. **Set Up Environment**: Create a virtual environment for LangTest using your preferred method. For example, you can use `venv` or `conda`. + +5. ### Install Poetry + +Poetry is the package manager used for this project. If you don't have Poetry installed, run the following command: + + ```bash + pip install poetry + ``` + +6. ### Install Dependencies + +Use Poetry to install the project dependencies: + + ```bash + poetry install --with dev + ``` \ No newline at end of file From 4a28360f32e180a923f055beba46833254acf675 Mon Sep 17 00:00:00 2001 From: Prikshit7766 Date: Wed, 9 Aug 2023 12:12:54 +0530 Subject: [PATCH 2/6] updated contributing guidlines --- CONTRIBUTING.md | 78 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2bf50d208..ce6759404 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -85,4 +85,80 @@ Use Poetry to install the project dependencies: ```bash poetry install --with dev - ``` \ No newline at end of file + ``` + +7. ### Make necessary changes and commit those changes + +Add those changes to the branch you just created using the `git add` command: + +``` +git add . +``` +Now commit those changes using the `git commit` command with a meaningful message: + +``` +git commit -m "Add feature: feature-name" +``` + +8. ### Push changes to GitHub + +Push your changes using the command `git push`: + +``` +git push -u origin your-branch-name +``` + +replacing `your-branch-name` with the name of the branch you created earlier. + +9. ### Submit your changes for review + +If you go to your repository on GitHub, you'll see a `Compare & pull request` button. Click on that button. + +create a pull request + +10. ### Create a pull request (PR) + +Create a pull request (PR) from your forked repository to the main LangTest repository. +- Clearly describe the changes you've made and the issue it addresses in the PR description. +- If the PR is related to an existing issue, mention it using the syntax "Fixes #issue_number." +> For pull request template click [here](https://github.com/JohnSnowLabs/langtest/blob/main/PULL_REQUEST_TEMPLATE.md) + +submit pull request + +Our team will review your pull request, provide feedback, and work with you to ensure that your contribution meets the project's guidelines and quality standards + +## Proposing a New Issue + +1. If you have an idea for a new feature, improvement, or bug fix, you can propose a new issue. +2. Go to the [Issue Tracker](https://github.com/JohnSnowLabs/langtest/issues) and click on "New Issue" or just create a new issue from [here](https://github.com/JohnSnowLabs/langtest/issues/new) +3. Choose the appropriate issue lables (feature, fix, bug, etc.). +4. Provide a clear and concise title and description of the proposed issue. +5. Add labels and assignees, if applicable, to help categorize and track the issue. + +We're excited to have you on board with us! Together, we can make NLP models safer, more reliable, and fairer for everyone. + +### **Happy contributing!** 💫 + +## Where to go from here? + +Congrats! You just completed the standard fork -> clone -> edit -> pull request workflow that you'll often encounter as a contributor! + +Celebrate your contribution and share it with your friends and followers by going to [LinkedIn](www.linkedin.com). + +You can join our community team if you need any help or have any questions. + +- [Slack](https://www.johnsnowlabs.com/slack-redirect/) For live discussion with the LangTest community, join the `#langtest` channel +- [GitHub](https://github.com/JohnSnowLabs/langtest/tree/main) For bug reports, feature requests, and contributions +- [Discussions](https://github.com/JohnSnowLabs/langtest/discussions) To engage with other community members, share ideas, and show off how you use LangTest! + +## Contributors + +We would like to acknowledge all contributors of this open-source community project. + + + + + +## License + +LangTest is released under the [Apache License 2.0](https://github.com/JohnSnowLabs/langtest/blob/main/LICENSE), which guarantees commercial use, modification, distribution, patent use, private use and sets limitations on trademark use, liability and warranty. \ No newline at end of file From 437fd5a2157865e5ad7128f4f61f82626743e5ca Mon Sep 17 00:00:00 2001 From: Rakshit Khajuria Date: Thu, 10 Aug 2023 19:31:11 +0530 Subject: [PATCH 3/6] Docs : Added Introduction Guidelines --- docs/pages/docs/contribute.md | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 docs/pages/docs/contribute.md diff --git a/docs/pages/docs/contribute.md b/docs/pages/docs/contribute.md new file mode 100644 index 000000000..36dec6c81 --- /dev/null +++ b/docs/pages/docs/contribute.md @@ -0,0 +1,43 @@ +--- +layout: docs +header: true +seotitle: Contribute | LangTest | John Snow Labs +title: Contribute to LangTest +key: docs-examples +permalink: /docs/pages/docs/contribute +modify_date: "2019-05-16" +--- + +We're thrilled that you're interested in contributing to our project. Your contributions can make a significant impact, and we appreciate your support in making [LangTest](https://github.com/JohnSnowLabs/langtest) even better. +Imagine you've identified an area in LangTest that could use improvement or a new feature. Here's a step-by-step guide on how to make a valid contribution: + +Prior to proceeding, ensure that you have meticulously reviewed each step outlined in the [Contribution file](https://github.com/JohnSnowLabs/langtest/blob/add-onboarding-materials/CONTRIBUTING.md). This preparation will equip you with the necessary knowledge to confidently make changes within your designated branch. + +> Let's suppose you're eager to add a robustness test. + +## Adding a New Test + +1. Navigate to the **transform** directory within the project. This directory contains all the supported test categories. Choose the category you want to work on. + +2. Inside the chosen category, you can create a class for example `Yourclassname` with a `transform` method responsible for transforming sentences by adding perturbations. + +```python + class Yourclassname(BaseRobustness): + """A class for ....... """ + alias_name = "your_class_name" + + @staticmethod + def transform(sample_list: List[Union[Sample, str]], prob: Optional[float] = 1.0) > List[Sample]: # params if required + """ + Docstrings + """ + #Your code here + + def yourfunction(text): + """ + Docstrings + """ + . + . + . +``` From 6f858bc5fd6ed98ab6fb199a2de5998ee955f126 Mon Sep 17 00:00:00 2001 From: Rakshit Khajuria Date: Thu, 10 Aug 2023 19:34:00 +0530 Subject: [PATCH 4/6] Docs: Added page to navigation.yml --- docs/_data/navigation.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/_data/navigation.yml b/docs/_data/navigation.yml index f9fe3eab7..f1fe34bf7 100644 --- a/docs/_data/navigation.yml +++ b/docs/_data/navigation.yml @@ -66,6 +66,12 @@ docs-menu: - title: Generating Augmentations url: /docs/pages/docs/generate_augmentation + - title: Contribute to LangTest + url: /docs/pages/docs/contribute + children: + - title: Contribution Guidelines + url: /docs/pages/docs/contribute + tutorials: - title: Tutorials url: /docs/pages/tutorials/tutorials From 9e097fefbf97f9af3c042adec0e2e9f60a6c24fd Mon Sep 17 00:00:00 2001 From: Prikshit7766 Date: Thu, 10 Aug 2023 20:03:27 +0530 Subject: [PATCH 5/6] docs(contribute.md): added contribution guidelines --- docs/pages/docs/contribute.md | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/docs/pages/docs/contribute.md b/docs/pages/docs/contribute.md index 36dec6c81..1dd748fae 100644 --- a/docs/pages/docs/contribute.md +++ b/docs/pages/docs/contribute.md @@ -41,3 +41,52 @@ Prior to proceeding, ensure that you have meticulously reviewed each step outlin . . ``` + +### Span Tracking + +In Named Entity Recognition (NER) tasks, accurately identifying entities within text is crucial. This requires keeping track of spans, which are the positions of the original word and the transformed word within the sentence. Accurate span recognition improves NER system performance and ensures precise entity identification. + +```python + transformations.append( + Transformation( + original_span=Span( + start=match.start(), + end=match.end(), + word=original_word, + ), + new_span=Span( + start=match.start(), + end=match.start() + len(transformed_word), + word=transformed_word, + ), + ignore=False, + ) + ) +``` + +> Span tracking is only necessary for text classification and NER tests. For question answering and summarization tests, span tracking is not required. + +### Feature Implementation Guidelines +- If your feature requires using specific data, you can add it to the **constants.py** file as a variable (e.g., a dictionary or a list). + +- Write the class name and it's corresponding alias name in the **constants.py** file within the `DEFAULT_PERTURBATIONS` and `PERTURB_CLASS_MAP` sections. + +- When contributing to LangTest, kindly ensure new features are added without introducing external dependencies + +### Testing Your Feature + +It is a good practive that you should add necessary tests after making any feature update or a fix etc. + +- You can find all of the test files neatly organized within the designated `test` directory. To ensure comprehensive testing coverage, it is of utmost importance that you create a test that corresponds specifically to your feature. + +- This test should be integrated into the **test_robustness.py** file, which serves as a central hub for assessing the resilience and effectiveness of various components. + +```python + def test_your_test_name(self) -> None: + """ + Test the Yourclassname ... + + """ + transformed_samples = Yourclassname.transform(self.sentences) + # add assertions to validate the transformed_samples +``` \ No newline at end of file From 2c5e6a2b83cf9ededfdc6a2dd2ff9631d0880b96 Mon Sep 17 00:00:00 2001 From: Prikshit7766 Date: Thu, 10 Aug 2023 20:05:58 +0530 Subject: [PATCH 6/6] docs(CONTRIBUTING.md): added link for example --- CONTRIBUTING.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ce6759404..faa4db631 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,9 @@ # Contributing to LangTest -Thank you for your interest in contributing to LangTest! We value the contributions of our community members and are excited to have you on board. To ensure a smooth and collaborative development process, please follow these guidelines: +Thank you for your interest in contributing to LangTest! We value the contributions of our community members and are excited to have you on board. . To make the development journey smooth and collaborative, please adhere to the following steps: +- Thoroughly review the guidelines provided below. +- If you're eager to add a new feature to the LangTest library, navigate to the [documentation](https://langtest.org/docs/pages/docs/contribute) for a clear understanding. +- To illustrate the process, we've included a simple example in the documentation to guide you. ## Finding an Issue