morphy 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +43 -0
- data/lib/morphy.rb +2 -2
- data/morphy.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffbef5e95829de72124f62a477969795869948e5
|
4
|
+
data.tar.gz: 462188fe9f72702fe28d8bb9549118fb959fa26c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
36
|
-
word.
|
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