# srt2corpus

> This is a tool for converting srt file into plain-text corpus

Latest version **1.0.1** (published 2018-03-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install srt2corpus
pnpm add srt2corpus
yarn add srt2corpus
bun add srt2corpus
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-03-31 |
| First published | 2018-03-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 8.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Caspar Chou |
| Maintainers | starcaspar |
| Keywords | corpus, subtitles |

## Links

- npm: https://www.npmjs.com/package/srt2corpus
- Repository: https://github.com/CasparChou/srt2corpus
- Homepage: https://github.com/CasparChou/srt2corpus#readme
- Issues: https://github.com/CasparChou/srt2corpus/issues
- npm.io page: https://npm.io/package/srt2corpus

## Dependencies (2)

- [chinese-conv](https://npm.io/package/chinese-conv.md) ^1.0.1
- [subtitles-parser](https://npm.io/package/subtitles-parser.md) 0.0.2

## Recent versions

- 1.0.1 (latest) — 2018-03-31
- 1.0.0 — 2018-03-31

## README

# srt2corpus

## What can srt2corpus do?
It can help you to convert srt file into CN-? parallel corpus

## Install
```shell
npm i srt2corpus
```

## Usage

```js
var fs = require('fs')
var corpus = require('srt2corpus')

// or use fs.readFile with callback
var data = fs.readFileSync(file.path, 'utf8') 
var results = corpus(data)

// add options
var results = corpus(data, {
  'verbose-each-line': false,
  'verbose-reason': false
})
```

## Options

key|Description|Default
--|--|--
skip-position-annotation| Skip SRT Formate (Not Implemented)|`true`
skip-no-parallel-corpus| Skip when just chinese (not parallel) |`true`
skip-multiple-line| Skip when multiple line subtitle |`true`
skip-not-acceptable-characters| Skip special characters |`true`
acceptable-symbols| Whitelist for special characters |`'!！?？「」,，.。`
auto-convert-to-traditional-chinese| Convert chinese to Traditional Chinese |`true`
auto-convert-to-simplified-chinese| Convert chinese to Simplified Chinese  |`false`
verbose-each-line| Verbose each subtitle |`true`
verbose-reason| Verbose when skip in which rule |`true`
parallel-corpus-separate-symbol| Custom your separate symbol/word  |`\n`

## Sample Result

```
{ id: '16',
  startTime: '00:00:35,720',
  endTime: '00:00:39,500',
  text: '就算一點欺詐行為  風投公司都認為是死罪\nEven a whiff of fraud is a mortal sin for VCs.' }
{ id: '17',
  startTime: '00:00:40,320',
  endTime: '00:00:42,760',
  text: '\'魔笛手\'品牌及其名下的所有資產現在\nPied Piper and all of its assets are now officially' }
{ id: '18',
  startTime: '00:00:42,760',
  endTime: '00:00:44,700',
  text: '正式屬于\'巴赫頭有限責任公司\'了\nthe property of Bachmanity LLC.' }
{ id: '19',
  startTime: '00:00:44,700',
  endTime: '00:00:48,010',
  text: '-你剛才說\'巴赫頭\'  -他們出價最高\n- Did you just say "Bachmanity?" - They had the highest bid?' }
{ id: '20',
  startTime: '00:00:48,010',
  endTime: '00:00:49,880',
  text: '那么  就賣給巴赫頭了\nBachmanity it is then.' }
{ id: '21',
  startTime: '00:00:50,550',
  endTime: '00:00:52,790',
  text: '理查德  是你救了我們\nRichard, you pulled us out of a nosedive.' }
{ id: '22',
  startTime: '00:00:52,800',
  endTime: '00:00:56,300',
  text: '當然了  我們必定會失敗\nOf course, inevitably we will plummet towards the earth,' }
```

```js
array = [
  '就算一點欺詐行為  風投公司都認為是死罪\nEven a whiff of fraud is a mortal sin for VCs.',
  '\'魔笛手\'品牌及其名下的所有資產現在\nPied Piper and all of its assets are now officially',
  '正式屬於\'巴赫頭有限責任公司\'了\nthe property of Bachmanity LLC.',
  '那麼  就賣給巴赫頭了\nBachmanity it is then.',
  '理查德  是你救了我們\nRichard, you pulled us out of a nosedive.',
  '當然了  我們必定會失敗\nOf course, inevitably we will plummet towards the earth,'
]
```

---
_Source: https://npm.io/package/srt2corpus · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
