<commit_before>Subdomain Blacklist
===================

List of common words that your users shouldn't use when setting up accounts.

[![Build Status](https://travis-ci.org/michaldudek/subdomain-blacklist.svg?branch=master)](https://travis-ci.org/michaldudek/subdomain-blacklist)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/55ab2d97-ebbc-46a9-844b-877ab991eafa/mini.png)](https://insight.sensiolabs.com/projects/55ab2d97-ebbc-46a9-844b-877ab991eafa)
[![HHVM Status](http://hhvm.h4cc.de/badge/michaldudek/subdomain-blacklist.png)](http://hhvm.h4cc.de/package/michaldudek/subdomain-blacklist)

When your app or service allows users to access their accounts using subdomains, e.g. `_michaldudek_.myapp.com`,
it is useful to block some words so they don't take away a subdomain you'd want to use in the future
or worse, try to trick your other users into believing they represent you (e.g. `_legal_.myapp.com` or
`_support_.myapp.com).

Apart from the blacklist, the goal of this repository is to provide code in various languages
that validates a username against the list.

Note that the goal of this library IS NOT to validate domain name. You still have to check whether or not
the given username makes a valid subdomain.

#### Acknowledgement

The idea and the list was originally taken from [Sandeep Shetty](https://github.com/sandeepshetty/subdomain-blacklist).

# Spec

Implementation MUST have a method/function called `validate` which takes a single string argument.

The `validate` method/function MUST return a boolean value.

Before a string is validates it MUST be normalized. Normalization of the string MUST:<commit_msg>Fix markdown in readme.<commit_after>Subdomain Blacklist
===================

List of common words that your users shouldn't use when setting up accounts.

[![Build Status](https://travis-ci.org/michaldudek/subdomain-blacklist.svg?branch=master)](https://travis-ci.org/michaldudek/subdomain-blacklist)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/55ab2d97-ebbc-46a9-844b-877ab991eafa/mini.png)](https://insight.sensiolabs.com/projects/55ab2d97-ebbc-46a9-844b-877ab991eafa)
[![HHVM Status](http://hhvm.h4cc.de/badge/michaldudek/subdomain-blacklist.png)](http://hhvm.h4cc.de/package/michaldudek/subdomain-blacklist)

When your app or service allows users to access their accounts using subdomains, e.g. `michaldudek.myapp.com`,
it is useful to block some words so they don't take away a subdomain you'd want to use in the future
or worse, try to trick your other users into believing they represent you (e.g. `legal.myapp.com` or
`support.myapp.com`).

Apart from the blacklist, the goal of this repository is to provide code in various languages
that validates a username against the list.

Note that the goal of this library IS NOT to validate domain name. You still have to check whether or not
the given username makes a valid subdomain.

#### Acknowledgement

The idea and the list was originally taken from [Sandeep Shetty](https://github.com/sandeepshetty/subdomain-blacklist).

# Spec

Implementation MUST have a method/function called `validate` which takes a single string argument.

The `validate` method/function MUST return a boolean value.

Before a string is validates it MUST be normalized. Normalization of the string MUST:
{'fraction_non_alphanumeric': 0.10166414523449319, 'fraction_numerical': 0.02178517397881997, 'mean_word_length': 5.156424581005586, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4636164', 'n_tokens_mistral': 1086, 'n_tokens_neox': 1003, 'n_words': 346}