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 +4 -4
- data/apion.gemspec +2 -2
- metadata +2 -4
- data/apion-0.1.0.gem +0 -0
- data/lib/apion.rb~ +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cc053ecce089de70f26278c6e54847318554381
|
4
|
+
data.tar.gz: fe37cf2d63c93cced1ee1a2de11032ea6334a8b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d177f752d1b49e4382d731642bffcbc4dddd647f9c82c062ec07e53154689c78d8ed0b0954c96dd2369d9ab43df21b18bc988a6507292e038d4b4f1bd786cb2d
|
7
|
+
data.tar.gz: d9441bd0a0de34ac698ec2a96abb4b8358077b905a5c48c10508c5bc17b1bbb49f8501e85ae103a04ae73fe2c57095d8f407b58809eb92d04c5b900b759e5583
|
data/apion.gemspec
CHANGED
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.
|
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-
|
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
|