credit-card-sms-parser 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe70511b2bbd9e06e8c90f98f1b1592292f0cf6d
4
- data.tar.gz: d120df01dee8cfacf5b69b83fa2dc2588295bac7
3
+ metadata.gz: 60bd0eebf64cda854c582b0f660cfe171f67c4ab
4
+ data.tar.gz: 9015d4d3912ff88d77b840ad6bd5e773a22eae0f
5
5
  SHA512:
6
- metadata.gz: 9510805546f5e30a4ee19aff3911c71518c620f7c1d175798c8e25d2ec3e14d6734203510cc39a10df71eda542f859917887d864b488d9664ea3a6fe69389f02
7
- data.tar.gz: fbb78887e63862203ee563ca5a72c92c51d3436568bf67c82161a32255a9d3e14097f56fd55767962ce4f791bfae619d20645d062b3b9b63ba265978754ba4b9
6
+ metadata.gz: 3e82bf0c07d589244a5880fc0d72954eced2a811265324b8a1a80ed56660c554a46beb7c102c63c64249c32f058a8dc201f9483176b8aa3fba099d09b0998321
7
+ data.tar.gz: 986d0e8a0fc77d022473436bfa5cfc57d058fea1032a7dcabdc9a48bf64ab581dcb74296c8b3dac6704b2c05ab270d2b536c2b68c10a082cbedb516a79e2db6f
data/README.md CHANGED
@@ -22,8 +22,11 @@ $ pry
22
22
  ## 현재까지 지원하는(걸로 추정되는) 카드사
23
23
  * 현대카드
24
24
  * 하나SK카드
25
+ * KEB 하나카드
25
26
  * 국민카드
27
+ * 국민체크카드
26
28
  * 농협
29
+ * 삼성법인카드
27
30
 
28
31
  ## 프로젝트에 기여하기
29
32
  파싱이 제대로 되지 않는 SMS 문자열을 Issue 에 올려주시거나 test 코드에 추가해주시면 반영해드립니다.
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'credit-card-sms-parser'
7
- spec.version = '0.2.2'
7
+ spec.version = '0.3.0'
8
8
  spec.authors = %w(Hanson Benjamin)
9
9
  spec.email = %w(jehokim@live.com)
10
10
  if spec.respond_to?(:metadata)
@@ -12,32 +12,33 @@ class String
12
12
  end
13
13
 
14
14
  class KoreanCreditCardLexer < RLTK::Lexer
15
- rule(/\[Web발신\]/) { |t| [:HEADER, t]}
16
- rule(/\(Web발신\)/) { |t| [:HEADER, t]}
17
- rule(/체크카드출금/) { |t| [:HEADER, t]}
18
- rule(/[\p{Hangul}\*]{2,4}님/) { |t| [:USER_NAME, t]}
19
- rule(/누적[\s:\-]?[\d,\-]+원/) { |t| [:MONEY_TOTAL, t.to_num] }
20
- rule(/누적-[\d,\-]+원/) { |t| [:MONEY_TOTAL, t.to_num] }
21
- rule(/[\d,\-]+원/) { |t| [:MONEY, t.to_num] }
22
- rule(/\(주\)\p{Hangul}+/) {|t| [:SHOP, t[3..-1]]}
23
- rule(/\p{Hangul}+\([\d\*]{4}\)/) {|t| [:CARD, t]}
24
- rule(/\S+은행/) {|t| [:BANK, t]}
25
- rule(/\S+카드/) {|t| [:CARD, t]}
26
- rule(/\d\d\/\d\d/) {|t| [:DATE, t]}
27
- rule(/\d\d:\d\d/) {|t| [:TIME, t]}
28
- rule(/일시불/) { :TYPE }
29
- rule(/^잔액$/) { :TYPE }
30
- rule(/주식회사\p{Hangul}+/) {|t| [:SHOP, t[4..-1]]}
15
+ rule(/\[Web발신\]/) { |t| [:header, t]}
16
+ rule(/\(Web발신\)/) { |t| [:header, t]}
17
+ rule(/체크카드출금/) { |t| [:header, t]}
18
+ rule(/[\p{Hangul}\*]{2,4}님/) { |t| [:user_name, t]}
19
+ rule(/누적[\s:\-]?[\d,\-]+원/) { |t| [:money_total, t.to_num] }
20
+ rule(/누적-[\d,\-]+원/) { |t| [:money_total, t.to_num] }
21
+ rule(/[\d,\-]+원/) { |t| [:money, t.to_num] }
22
+ rule(/\(주\)\p{Hangul}+/) {|t| [:shop, t[3..-1]]}
23
+ rule(/\p{Hangul}+\([\d\*]{4}\)/) {|t| [:card, t]}
24
+ rule(/\S+은행/) {|t| [:bank, t]}
25
+ rule(/KEB하나/) {|t| [:bank, t]}
26
+ rule(/\S+카드/) {|t| [:card, t]}
27
+ rule(/\d\d\/\d\d/) {|t| [:date, t]}
28
+ rule(/\d\d:\d\d/) {|t| [:time, t]}
29
+ rule(/일시불/) { :type }
30
+ rule(/^잔액$/) { :type }
31
+ rule(/주식회사\p{Hangul}+/) {|t| [:shop_name, t[4..-1]]}
31
32
  rule(/^\p{Hangul}+( +\p{Hangul}+)*?$/) { |t|
32
33
  t.chomp!(' 사용')
33
34
  t.chomp!(' 일시불')
34
- [:SHOP, t.strip]
35
+ [:shop_name, t.strip]
35
36
  }
36
- rule(/[A-Za-z\p{Hangul}]+/) {|t| [:SHOP, t.strip]}
37
- rule(/\//) {|t| [:SLASH, t]}
38
- rule(/[\p{L}\p{P}]+/) {|t| [:WORD, t]}
39
- rule(/[\d\*]+/) { :NUMBER }
40
- rule(/\s/) {|t| [:SPACE, t]}
37
+ rule(/[A-Za-z\p{Hangul}]+/) {|t| [:shop_name, t.strip]}
38
+ rule(/[\p{L}]+/) {|t| [:word, t]}
39
+ rule(/[\p{P}]+/) {|t| [:punctuation, t]}
40
+ rule(/[\d\*]+/) { :number }
41
+ rule(/\s/) {|t| [:space, t]}
41
42
  end
42
43
 
43
44
  module CreditCardSmsParser
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: credit-card-sms-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hanson