apion 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2dd16503da79fcb82019addc0d0473d2cf4fa6f6
4
- data.tar.gz: 41d8768701806beaf03bed5162445b86abd9515a
3
+ metadata.gz: 8cc053ecce089de70f26278c6e54847318554381
4
+ data.tar.gz: fe37cf2d63c93cced1ee1a2de11032ea6334a8b4
5
5
  SHA512:
6
- metadata.gz: f8289f6977ace26b36afd0bad2fac58ff7ef108df6b33c77c37e4a514b61870e611226d102f90218630446c44d1d73dc4a1fda63f9d3bbddc3c2d84f3328a2a4
7
- data.tar.gz: bde4153a1ee1164eafa7eb248839e176bd5bc8e0bc815c1aa8f6d355229509e4c7bdc9a4f1a4e8a1c8683be3fda68eb7c68e75291bd9bff8c676dc5bffbfc19a
6
+ metadata.gz: d177f752d1b49e4382d731642bffcbc4dddd647f9c82c062ec07e53154689c78d8ed0b0954c96dd2369d9ab43df21b18bc988a6507292e038d4b4f1bd786cb2d
7
+ data.tar.gz: d9441bd0a0de34ac698ec2a96abb4b8358077b905a5c48c10508c5bc17b1bbb49f8501e85ae103a04ae73fe2c57095d8f407b58809eb92d04c5b900b759e5583
data/apion.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'apion'
3
- s.version = '0.1.0'
4
- s.date = '2013-08-21'
3
+ s.version = '0.1.1'
4
+ s.date = '2013-08-24'
5
5
  s.summary = "Apion"
6
6
  s.description = "Easy-to-use Fr/Api translator"
7
7
  s.authors = ["Galaad Gauthier"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Galaad Gauthier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-21 00:00:00.000000000 Z
11
+ date: 2013-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -32,9 +32,7 @@ extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
34
  - Gemfile
35
- - apion-0.1.0.gem
36
35
  - apion.gemspec
37
- - lib/apion.rb~
38
36
  - lib/apion.rb
39
37
  - data/dict.json
40
38
  - data/conversion.csv
data/apion-0.1.0.gem DELETED
Binary file
data/lib/apion.rb~ DELETED
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "json"
4
-
5
- ROOT = File.expand_path("../..", __FILE__)
6
- SPE = /([(0-9)|•|—|–|\-|,|?|!|^|\r|°|“|”|...|\u00a0|«|»|…|\\|\/|!|?|\"|\'|\[|\]|\(|\)|\]|<|>|=|+|%|$|&|#|;|*|:|}|{|`])/
7
-
8
- def parseCSV(path)
9
- Hash[File.open("#{ROOT}/data/#{path}.csv").read.split("\n").map {|ligne| ligne.split("#")}]
10
- end
11
-
12
- def exceptions
13
- @exceptions ||= JSON.parse(File.read("#{ROOT}/data/dict.json"))
14
- end
15
-
16
- def conversion
17
- @conversion ||= parseCSV "conversion"
18
- end
19
-
20
- def apion(texte)
21
- texte = texte.downcase
22
- texte.gsub(SPE, "").split.map do |mot|
23
- exceptions[mot] || "".tap do |result|
24
- conversion.select { |regle| mot =~ /#{regle}/ }.first.tap do |regle, api|
25
- mot.sub! /#{regle}/, ""
26
- result << api.to_s
27
- end until mot.empty?
28
- end
29
- end
30
- end