<commit_before># YandexImageModeration

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/yandex_image_moderation`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'yandex_image_moderation'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install yandex_image_moderation

## Usage

TODO: Write usage instructions here

## Development

After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/yandex_image_moderation.


## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
<commit_msg>Readme edited (not complete yet).<commit_after># YandexImageModeration

This gem provides a class for access to Yandex Image Moderation API
(https://imagemoderation.yandexdatafactory.com/)

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'yandex_image_moderation'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install yandex_image_moderation

## Configuration

For Yandex API access you have to provide an API key. Do it by calling config method of the YandexImageModeration class:

```ruby
YandexImageModeration.config do |c|
  c.token = 'your_API_key'
end
```

If you use Rails, this configuration would probably go into a proper initializer.

In some cases you may need to change URL of the API (i.e. when you use not the SAAS API, but a docker version on your own server).
To override the standard URL just add url attribute to the config. In the URL provide the path to the *moderate* service, do not add any parameters like *?model=moderate...*

```ruby
YandexImageModeration.config do |c|
  c.url = 'http://your_server/path_to/moderate'
  c.token = '<PASSWORD>_<PASSWORD>'
end
```

## Usage

To moderate an image (remember: Yandex API works with JPEG only) just call a *moderate* methods with a path to the image file as a parameter:

```ruby
result = YandexImageModeration.moderate('/var/www/uploads/test.jpg')
puts result


```

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/yandex_image_moderation.

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

## Build Status [![Build Status](https://secure.travis-ci.org/panthomakos/timezone.png?branch=master)](http://travis-ci.org/panthomakos/timezone)
{'fraction_non_alphanumeric': 0.08508634222919938, 'fraction_numerical': 0.0, 'mean_word_length': 4.5025906735751295, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 5, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3646837', 'n_tokens_mistral': 976, 'n_tokens_neox': 916, 'n_words': 405}