sequitur 0.0.06 → 0.0.07
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +3 -0
- data/lib/sequitur/constants.rb +1 -1
- data/lib/sequitur/digram.rb +11 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjliZTY3NWVkYWRmNzI3ZmZmNDI2YWU5ZjY0NzUxZjg1ZWQ3ZTFmMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Y2ZjNGYxNDk1NGYxMTE5NTBiYzkyOWYyMGRjYmUyNGMzMGE2MTUxZQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzBmZDFiMGQyNWFiNjMzMDAwYTM3ODQ0ZDk4YmUzMTNiYmNjNTE3MGU2ZWZl
|
10
|
+
ZjNmNzdkYzgwOTZiZmZjYjM2NzVkNDIxODhlZDMwMjM1YjIxMDA5ZjhkMTU5
|
11
|
+
ZGNkMDQwNDZkNDRmMWI4NWY2ZWIyMWQwYTAwZDZlZjNjOTVjNWQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDEzY2IyZDk5ZGMxMWY0ZDJiZGMxZDA2ZDM2MzcwNTRhNTRhYWEyODUxNDBl
|
14
|
+
ZTE2OTUxOGM4ZDk4MTdlYmU0ZWI1NGM0ZTNlMWI5MTgzMzg3Y2FmMzhhNTU3
|
15
|
+
ZmYxMTg3NGNkMDljZGQ3MzhmMmQyMWNkZWQ2NjFiYzhlZTlmNTY=
|
data/CHANGELOG.md
CHANGED
data/lib/sequitur/constants.rb
CHANGED
data/lib/sequitur/digram.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
+
# File: digram.rb
|
2
|
+
|
1
3
|
module Sequitur # Module for classes implementing the Sequitur algorithm
|
2
4
|
|
3
|
-
#
|
5
|
+
# In linguitics, a digram is a sequence of two letters.
|
6
|
+
# In Sequitur a digram is a sequence of two consecutive symbols that
|
7
|
+
# appear in a grammar (production) rule. Each symbol in a digram
|
8
|
+
# can be a terminal or not.
|
4
9
|
class Digram
|
5
10
|
# The sequence of two consecutive grammar symbols.
|
6
11
|
attr_reader(:symbols)
|
@@ -12,12 +17,16 @@ class Digram
|
|
12
17
|
attr_reader(:key)
|
13
18
|
|
14
19
|
# Constructor.
|
20
|
+
# @param symbol1 [StringOrSymbol] First element of the digram
|
21
|
+
# @param symbol2 [StringOrSymbol] Second element of the digram
|
22
|
+
# @param aProduction [Production] Production in which the RHS
|
23
|
+
# the sequence symbol1 symbol2 appears.
|
15
24
|
def initialize(symbol1, symbol2, aProduction)
|
16
25
|
@symbols = [symbol1, symbol2]
|
17
26
|
@key = "#{symbol1.hash.to_s(16)}:#{symbol2.hash.to_s(16)}"
|
18
27
|
@production_id = aProduction.object_id
|
19
28
|
end
|
20
|
-
|
29
|
+
|
21
30
|
# Return the production object of this digram
|
22
31
|
def production()
|
23
32
|
ObjectSpace._id2ref(production_id)
|