<commit_before>DocRipper is an extremely lightweight Ruby wrapper that can be used to parse text contents from common file formats (currently .doc, .docx and .pdf) without the need for a large number of dependencies like an OCR library or OpenOffice/LibreOffice.

For simple parsing, you'll likely see a large performance improvement with DocRipper over solutions that rely on OpenOffice/LibreOffice for .doc/.docx conversion. I found

Need OCR support or in-image text parsing? Take a look at [Docsplit](https://github.com/documentcloud/docsplit).

## Quickstart

  ```
    gem install doc_ripper
  ```
  ### Specify a file to parse

  ```
    DocRipper::TextRipper.new('/path/to/file')
  ```

  ### Return the file's text
  ```
    dr = DocRipper::TextRipper.new('/path/to/file')
    dr.text
    => "Document's text"
  ```

  If the file cannot be read, nil will be returned.

  ```
    dr = DocRipper::TextRipper.new('/path/to/missing/file')
    dr.text
    => nil
  ```


## Dependencies
 - Ruby version >= 1.9.2
 - [Poppler-utils/(pdftotext)](http://poppler.freedesktop.org/) (PDF)
 - [Antiword](http://www.winfield.demon.nl/) (docx) more info: http://linux.die.net/man/1/antiword<commit_msg>fix indentation of text on readme<commit_after>DocRipper is an extremely lightweight Ruby wrapper that can be used to parse text contents from common file formats (currently .doc, .docx and .pdf) without the need for a large number of dependencies like an OCR library or OpenOffice/LibreOffice.

For simple parsing, you'll likely see a large performance improvement with DocRipper over solutions that rely on OpenOffice/LibreOffice for .doc/.docx conversion. I found

Need OCR support or in-image text parsing? Take a look at [Docsplit](https://github.com/documentcloud/docsplit).

## Quickstart

```
  gem install doc_ripper
```
### Specify a file to parse

```
  DocRipper::TextRipper.new('/path/to/file')
```

### Return the file's text
```
  dr = DocRipper::TextRipper.new('/path/to/file')
  dr.text
  => "Document's text"
```

If the file cannot be read, nil will be returned.

```
  dr = DocRipper::TextRipper.new('/path/to/missing/file')
  dr.text
  => nil
```


## Dependencies
 - Ruby version >= 1.9.2
 - [Poppler-utils/(pdftotext)](http://poppler.freedesktop.org/) (PDF)
 - [Antiword](http://www.winfield.demon.nl/) (docx) more info: http://linux.die.net/man/1/antiword
{'fraction_non_alphanumeric': 0.13047138047138046, 'fraction_numerical': 0.003367003367003367, 'mean_word_length': 3.8313008130081303, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '5228218', 'n_tokens_mistral': 781, 'n_tokens_neox': 735, 'n_words': 242}