diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..cee2f2f --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at support@cucco.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/README.rst b/README.rst index 55b45a9..c91f784 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ -cucco |Build Status| |codecov| |beerpay| -======================================== +cucco |Build Status| |codecov| |patreon| |gitter| +================================================= Is that... is that a cucco? Sure it is! @@ -99,5 +99,7 @@ Not in the mood to implement it yourself? You can still create an issue and comm :target: https://travis-ci.org/davidmogar/cucco .. |codecov| image:: https://codecov.io/gh/davidmogar/cucco/branch/master/graph/badge.svg :target: https://codecov.io/gh/davidmogar/cucco -.. |beerpay| image:: https://beerpay.io/davidmogar/cucco/badge.svg?style=flat - :target: https://beerpay.io/davidmogar/cucco +.. |patreon| image:: https://img.shields.io/badge/support%20on-patreon-red.svg + :target: https://www.patreon.com/davidmogar +.. |gitter| image:: https://img.shields.io/gitter/room/nwjs/nw.js.svg + :target: https://gitter.im/davidmogar/cucco diff --git a/cucco/cucco.py b/cucco/cucco.py index fe9855f..6fc2fd1 100644 --- a/cucco/cucco.py +++ b/cucco/cucco.py @@ -46,7 +46,7 @@ def _load_stop_words(self, language=None): language: Language code. Returns: - A boolean indicating if the file was loaded. + A boolean indicating whether a file was loaded. """ self._logger.debug('Loading stop words') @@ -65,7 +65,7 @@ def _load_stop_words(self, language=None): def _parse_normalizations(normalizations): """Parse and yield normalizations. - Parse normalizations parameter yielding all normalizations and + Parse normalizations parameter that yield all normalizations and arguments found on it. Args: @@ -74,7 +74,7 @@ def _parse_normalizations(normalizations): Yields: A tuple with a parsed normalization. The first item will contain the normalization name and the second will be a dict - with the arguments to use for the normalization. + with the arguments to be used for the normalization. """ str_type = str if sys.version_info[0] > 2 else (str, unicode) @@ -84,8 +84,8 @@ def _parse_normalizations(normalizations): def _parse_stop_words_file(self, path): """Load stop words from the given path. - Parse an stop words file, saving each word found in it in a set - for the languaage of the file. This language is obtained from + Parse the stop words file, saving each word found in it in a set + for the language of the file. This language is obtained from the file name. If the file doesn't exist, the method will have no effect. @@ -93,7 +93,7 @@ def _parse_stop_words_file(self, path): path: Path to the stop words file. Returns: - A boolean indicating if the file was loaded. + A boolean indicating whether the file was loaded. """ language = None loaded = False @@ -116,8 +116,8 @@ def _parse_stop_words_file(self, path): def normalize(self, text, normalizations=None): """Normalize a given text applying all normalizations. - Normalizations to apply can be specified through a list - parameter and will be executed in the same order. + Normalizations to apply can be specified through a list of + parameters and will be executed in that order. Args: text: The text to be processed. @@ -140,9 +140,8 @@ def normalize(self, text, normalizations=None): def remove_accent_marks(text, excluded=None): """Remove accent marks from input text. - This function remove accent marks in the text, leaving - untouched unicode characters defined in the 'excluded' - parameter. + This function removes accent marks in the text, but leaves + unicode characters defined in the 'excluded' parameter. Args: text: The text to be processed. @@ -164,7 +163,7 @@ def remove_extra_white_spaces(text): """Remove extra white spaces from input text. This function removes white spaces from the beginning and - the end of the string, but also duplicated white spaces + the end of the string, but also duplicates white spaces between words. Args: @@ -179,12 +178,12 @@ def remove_stop_words(self, text, ignore_case=True, language=None): """Remove stop words. Stop words are loaded on class instantiation according - with the specified language. + to the specified language. Args: text: The text to be processed. - ignore_case: Whether or not ignore case. - language: Code of the language to use. + ignore_case: Whether or not to ignore case. + language: Code of the language to use (defaults to 'en'). Returns: The text without stop words. @@ -203,7 +202,7 @@ def remove_stop_words(self, text, ignore_case=True, language=None): def replace_characters(self, text, characters, replacement=''): """Remove characters from text. - Remove custom characters from input text or replace them + Removes custom characters from input text or replaces them with a string if specified. Args: @@ -230,7 +229,7 @@ def replace_characters(self, text, characters, replacement=''): def replace_emails(text, replacement=''): """Remove emails address from text. - Remove email addresses from input text or replace them + Removes email addresses from input text or replaces them with a string if specified. Args: @@ -246,7 +245,7 @@ def replace_emails(text, replacement=''): def replace_emojis(text, replacement=''): """Remove emojis from text. - Remove emojis from input text or replace them with a + Removes emojis from input text or replaces them with a string if specified. Args: @@ -254,7 +253,7 @@ def replace_emojis(text, replacement=''): replacement: New text that will replace emojis. Returns: - The text without hyphens. + The text without emojis. """ return regex.EMOJI_REGEX.sub(replacement, text) @@ -262,12 +261,12 @@ def replace_emojis(text, replacement=''): def replace_hyphens(text, replacement=' '): """Replace hyphens in text. - Replace hyphens from input text with a whitespace or a + Replaces hyphens from input text with a whitespace or a string if specified. Args: text: The text to be processed. - replacement: New text that will replace hyphens. + replacement: New text that will replace the hyphens. Returns: The text without hyphens. @@ -277,8 +276,8 @@ def replace_hyphens(text, replacement=' '): def replace_punctuation(self, text, excluded=None, replacement=''): """Replace punctuation symbols in text. - Remove punctuation from input text or replace them with a - string if specified. Characters replaces will be those + Removes punctuation from input text or replaces them with a + string if specified. Characters replaced will be those in string.punctuation. Args: @@ -306,7 +305,7 @@ def replace_symbols( replacement=''): """Replace symbols in text. - Remove symbols from input text or replace them with a + Removes symbols from input text or replaces them with a string if specified. Args: @@ -330,7 +329,7 @@ def replace_symbols( def replace_urls(text, replacement=''): """Replace URLs in text. - Remove URLs from input text or replace them with a + Removes URLs from input text or replaces them with a string if specified. Args: