music-text-normalization 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +9 -0
- data/README.md +3 -1
- data/Rakefile +7 -0
- data/lib/music/text/normalization.rb +5 -2
- data/lib/music/text/normalization/version.rb +1 -1
- data/music-text-normalization.gemspec +1 -1
- data/spec/music/text/normalization_spec.rb +4 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96eb8c787372d979bbf78b65941f7022c1ed4e52
|
4
|
+
data.tar.gz: 80a9fa1c8455a2c9a4393e6bd6b5dcfdfd5401f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2046e58b2d2bfb0a354ed2cdb7866c060d749c20a14100304c52813d22034afbba5a0326721daacbdbede3f4399c98cf0f1fda3dcbefbb7b3893c85a5c587eeb
|
7
|
+
data.tar.gz: af6f0953813dbb0a10e03c8a1db0f604830ee99e1841376108e6665e8f3132d4599c993719f2381476c8523da0cc3571384d19918a07486a76cb70ce992a2e06
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# music-text-normalization
|
1
|
+
# music-text-normalization [![Build Status](https://secure.travis-ci.org/youpy/music-text-normalization.png)](http://secure.travis-ci.org/youpy/music-text-normalization)
|
2
2
|
|
3
3
|
A library for normalizing music related texts
|
4
4
|
|
@@ -21,6 +21,8 @@ Or install it yourself as:
|
|
21
21
|
## Usage
|
22
22
|
|
23
23
|
```ruby
|
24
|
+
require 'music/text/normalization'
|
25
|
+
|
24
26
|
include Music::Text::Normalization
|
25
27
|
|
26
28
|
normalize_artist_name('Run-D.M.C.') # => 'run_dmc'
|
data/Rakefile
CHANGED
@@ -1,10 +1,13 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
require "music/text/normalization/version"
|
2
3
|
|
3
4
|
module Music
|
4
5
|
module Text
|
5
6
|
module Normalization
|
6
7
|
def normalize_artist_name(text)
|
7
|
-
lowercase_name = text.
|
8
|
+
lowercase_name = text.
|
9
|
+
tr("0-9A-Za-z", "0-9A-Za-z").
|
10
|
+
downcase
|
8
11
|
|
9
12
|
case lowercase_name
|
10
13
|
when 'bruce springsteen and the e street band'
|
@@ -21,7 +24,7 @@ module Music
|
|
21
24
|
lowercase_name.
|
22
25
|
gsub(/['\.]/, '').
|
23
26
|
sub(/^(a|an|the)\ +/, '').
|
24
|
-
gsub(/[^a-z0-9]+/, '_').
|
27
|
+
gsub(/[^a-z0-9\p{Hiragana}\p{Katakana}ー-一-龠々]+/, '_').
|
25
28
|
sub(/^_/, '').sub(/_$/, '')
|
26
29
|
end
|
27
30
|
end
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["youpy@buycheapviagraonlinenow.com"]
|
11
11
|
spec.summary = %q{A library for normalizing music related texts}
|
12
12
|
spec.description = %q{A library for normalizing music related texts}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/youpy/music-text-normalization"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
3
|
|
3
4
|
include Music::Text
|
@@ -17,6 +18,9 @@ describe Normalization do
|
|
17
18
|
expect(Normalization.normalize_artist_name("A New Found Glory")).to eql('new_found_glory')
|
18
19
|
expect(Normalization.normalize_artist_name("The Beatles")).to eql('the_beatles')
|
19
20
|
expect(Normalization.normalize_artist_name("The Verve")).to eql('the_verve')
|
21
|
+
expect(Normalization.normalize_artist_name("ヒカシュー")).to eql('ヒカシュー')
|
22
|
+
expect(Normalization.normalize_artist_name("水曜日のカンパネラ")).to eql('水曜日のカンパネラ')
|
23
|
+
expect(Normalization.normalize_artist_name("the Beatles")).to eql('the_beatles')
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: music-text-normalization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- youpy
|
@@ -61,6 +61,7 @@ extra_rdoc_files: []
|
|
61
61
|
files:
|
62
62
|
- .gitignore
|
63
63
|
- .rspec
|
64
|
+
- .travis.yml
|
64
65
|
- Gemfile
|
65
66
|
- LICENSE.txt
|
66
67
|
- README.md
|
@@ -70,7 +71,7 @@ files:
|
|
70
71
|
- music-text-normalization.gemspec
|
71
72
|
- spec/music/text/normalization_spec.rb
|
72
73
|
- spec/spec_helper.rb
|
73
|
-
homepage:
|
74
|
+
homepage: https://github.com/youpy/music-text-normalization
|
74
75
|
licenses:
|
75
76
|
- MIT
|
76
77
|
metadata: {}
|