Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/davidmogar/cucco
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmogar committed Jun 27, 2017
2 parents 67260d8 + 759154e commit 826aa17
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 29 deletions.
46 changes: 46 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -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 [email protected]. 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/
10 changes: 6 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cucco |Build Status| |codecov| |beerpay|
========================================
cucco |Build Status| |codecov| |patreon| |gitter|
=================================================

Is that... is that a cucco? Sure it is!

Expand Down Expand Up @@ -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
49 changes: 24 additions & 25 deletions cucco/cucco.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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:
Expand All @@ -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)

Expand All @@ -84,16 +84,16 @@ 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.
Args:
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
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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:
Expand All @@ -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.
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -246,28 +245,28 @@ 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:
text: The text to be processed.
replacement: New text that will replace emojis.
Returns:
The text without hyphens.
The text without emojis.
"""
return regex.EMOJI_REGEX.sub(replacement, text)

@staticmethod
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.
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 826aa17

Please sign in to comment.