morphy 0.0.2 → 0.0.3

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +43 -0
  3. data/lib/morphy.rb +2 -2
  4. data/morphy.gemspec +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b43f66704e182de7a6a769d26af691e3b9b0908
4
- data.tar.gz: e14b55a2d7f9fa0c243a09a1f45fe228dd66f7f5
3
+ metadata.gz: ffbef5e95829de72124f62a477969795869948e5
4
+ data.tar.gz: 462188fe9f72702fe28d8bb9549118fb959fa26c
5
5
  SHA512:
6
- metadata.gz: a315b4f4e728a911f1c43c37d6edf070de3a811fda7c37b1a3fa9dd4d63c5169fea66f4e39e613265b5db240c44465fe95561e7655c54b4b3cfc78ca5e6368c2
7
- data.tar.gz: 26a74f2bd352689e220c6efe79e19dbed73b89b2bad1c46174c4e73c51753341243bc83242275e00e41974e2f4cec477631462c794538a801f9793f978e2d715
6
+ metadata.gz: ae7c186490bd5f217953f27727879d9afaccc3c21a2f54ab53aa117d6d64822695d187d21974d9f484c41531c5a1db01a5ee477c0c035e5c61f78bfea063948d
7
+ data.tar.gz: 160c9cfa219860ecebc06955ac165b93f9db067fd6c7b3c67d33160113b8ce17a5638fb29c653100991bfaca8f57f49ca1e9419aca3f3d750df6ca39f899bf6d
data/README.md CHANGED
@@ -1,2 +1,45 @@
1
1
  # morphy
2
2
  Morphological analyzer (POS tagger + inflection engine) for Russian language in ruby. Inspired by pymorphy2
3
+
4
+ ## Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ gem 'morphy'
9
+
10
+ And then execute:
11
+
12
+ $ bundle
13
+
14
+ Or install it yourself as:
15
+
16
+ $ gem install morphy
17
+
18
+ ## Usage
19
+ # Words must be added in alphabetical order
20
+ require "morphy"
21
+
22
+ morphy = Morphy.new
23
+
24
+ word = morphy.find_similar("облако").first
25
+
26
+ datv = word.inflect(["datv"])
27
+ datv.to_s
28
+ => облаку
29
+ datv.inflect(["nomn"]).to_s
30
+ => облако
31
+ datv.lexemme.map(&:to_s)
32
+ => ["облако", "облака", "облаку", "облако", "облаком", "облаке", "облака", "облаков", "облакам", "облака", "облаками", "облаках"]
33
+ datv.normal_form
34
+ => облако
35
+
36
+
37
+
38
+ ## Contributing
39
+
40
+ 1. Fork it
41
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
42
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
43
+ 4. Push to the branch (`git push origin my-new-feature`)
44
+ 5. Create new Pull Request
45
+
data/lib/morphy.rb CHANGED
@@ -32,8 +32,8 @@ class Morphy
32
32
  suffix = Morphy.suffixes[Morphy.paradigms[@para_id][1]]
33
33
  grammeme = Morphy.grammemes[Morphy.paradigms[@para_id][2]]
34
34
  word = @word.dup
35
- word.gsub!(Morphy.prefixes[@prefix_id],"")
36
- word.gsub!(Morphy.suffixes[@suffix_id],"")
35
+ word.sub!(Morphy.prefixes[@prefix_id],"")
36
+ word = word.reverse.sub(Morphy.suffixes[@suffix_id],"").reverse
37
37
  word
38
38
  end
39
39
 
data/morphy.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "morphy"
5
- spec.version = "0.0.2"
5
+ spec.version = "0.0.3"
6
6
  spec.date = '2015-05-29'
7
7
  spec.authors = ["Maksatbek Mansurov"]
8
8
  spec.email = ["maksat.mansurov@gmail.com"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: morphy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maksatbek Mansurov