Sha256: 1120743a82733439ca226d240440aebd0c0786fc846476132b73d8ec1079ae35

Contents?: true

Size: 981 Bytes

Versions: 1

Compression:

Stored size: 981 Bytes

Contents

# CmpText
最新版本 0.1.4
## Installation

添加这行代码到你的 Gemfile:

```ruby
gem 'cmp_text'
```

然后执行:

    $ bundle

或者直接安装:

    $ gem install cmp_text

## Usage

你可以填写两个参数,参数可以是文件,也可以是字符串:

```ruby
  CmpText::Analysis.txt_cmp(file_1, file_2)
```
或者:

```ruby
  CmpText::Analysis.txt_cmp(str_1, str_2)
```

## Example

例如直接输入两个字符串:

```ruby
  CmpText::Analysis.txt_cmp('我来自武汉','我来自中国') # => 0.60
```

或者用print方法打印出JSON结果, 'succ_char'比对成功的部分,'failed_char'比对失败的部分:

```ruby
CmpText::Analysis.print('我来自武汉','我来自中国')
```

结果:
```ruby
{
  :result => "匹配度是 60.0%",
  :data => {
    :or_text_1 => "我来自武汉",
    :or_text_2 => "我来自中国",
    :succ_char => [
      [0] "我来自"
    ],
    :failed_char => [
      [0] "中国",
      [1] "武汉"
    ]
  }
}
```

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cmp_text-0.1.4 README.md