-
Notifications
You must be signed in to change notification settings - Fork 49
Docs/Added Contribution Guidelines #701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2c91a83
Docs: Added Contribution Guidelines
RakshitKhajuria 4a28360
updated contributing guidlines
Prikshit7766 437fd5a
Docs : Added Introduction Guidelines
RakshitKhajuria 5648377
Merge branch 'add-onboarding-materials' of https://github.com/JohnSno…
RakshitKhajuria 6f858bc
Docs: Added page to navigation.yml
RakshitKhajuria 9e097fe
docs(contribute.md): added contribution guidelines
Prikshit7766 2c5e6a2
docs(CONTRIBUTING.md): added link for example
Prikshit7766 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,167 @@ | ||
| # 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 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 | ||
|
|
||
| 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 | ||
|
|
||
| <img align="right" width="300" src="https://github.com/RakshitKhajuria/first-contributions/assets/71117423/be22d54d-5b62-4a23-b213-0268ed195021" alt="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 | ||
|
|
||
| <img align="right" width="300" src="https://github.com/RakshitKhajuria/test/assets/71117423/b07c7d60-ab80-4b7f-b972-58fcd1f50741" alt="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. | ||
|
|
||
| <img align="right" width="300" src="https://github.com/RakshitKhajuria/test/assets/71117423/8eef9f61-283d-4bad-9e7f-8a526e33615e" alt="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 | ||
| ``` | ||
|
|
||
| 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. | ||
|
|
||
| <img style="float: right;" src="https://github.com/RakshitKhajuria/test/assets/71117423/86cb56af-1dad-467e-afc1-f4594615783b" alt="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) | ||
|
|
||
| <img style="float: right;" src="https://github.com/RakshitKhajuria/test/assets/71117423/5c629508-53a7-4444-b036-15f694df675c" alt="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. | ||
|
|
||
| <a href="https://github.com/johnsnowlabs/langtest/graphs/contributors"> | ||
| <img src="https://contrib.rocks/image?repo=johnsnowlabs/langtest" /> | ||
| </a> | ||
|
|
||
| ## 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| --- | ||
| 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 | ||
| """ | ||
| . | ||
| . | ||
| . | ||
| ``` | ||
|
|
||
| ### 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 | ||
| ``` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.