nlp 0.2.3 → 0.2.5

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.
data/lib/token_scanner.rb CHANGED
@@ -28,12 +28,15 @@ module NLP
28
28
  while @pos < @tokens.size and !@tokens[@pos].number?
29
29
  @pos+= 1
30
30
  end
31
+ when :alphanum
32
+ while @pos < @tokens.size and !@tokens[@pos].number? and !@tokens[@pos].word?
33
+ @pos+= 1
34
+ end
31
35
  end
32
36
  end
33
37
 
34
38
 
35
- def current
36
-
39
+ def current
37
40
  if @pos == @tokens.size
38
41
  nil
39
42
  else
@@ -42,6 +45,10 @@ module NLP
42
45
 
43
46
  end
44
47
 
48
+ def rewind
49
+ @pos = 0
50
+ end
51
+
45
52
 
46
53
  def index
47
54
  @pos
@@ -57,7 +64,7 @@ module NLP
57
64
 
58
65
  def flatten_text(text)
59
66
  flattened = []
60
- text.each { |s| s.tokens.each {|t| flattened.push t } }
67
+ text.sentences.each { |s| s.tokens.each {|t| flattened.push t } }
61
68
  flattened
62
69
  end
63
70
 
data/lib/word.rb CHANGED
@@ -7,6 +7,7 @@ module NLP
7
7
  include Meaningable
8
8
 
9
9
  attr_reader :lemat, :orth
10
+ attr_accessor :category
10
11
 
11
12
  def initialize(word, lemat, tags)
12
13
  super(word,tags)
@@ -17,5 +18,6 @@ module NLP
17
18
  @tags
18
19
  end
19
20
 
21
+
20
22
  end
21
23
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nlp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 3
10
- version: 0.2.3
9
+ - 5
10
+ version: 0.2.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - knife
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-18 00:00:00 +02:00
18
+ date: 2010-09-22 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -29,6 +29,7 @@ extra_rdoc_files:
29
29
  - LICENSE
30
30
  - README.rdoc
31
31
  files:
32
+ - dict/liwc
32
33
  - dict/rid
33
34
  - lib/analyzer.rb
34
35
  - lib/category.rb
@@ -49,6 +50,7 @@ files:
49
50
  - lib/stree.rb
50
51
  - lib/takipi_web_service
51
52
  - lib/takipi_web_service.rb
53
+ - lib/text.rb
52
54
  - lib/token.rb
53
55
  - lib/token_scanner.rb
54
56
  - lib/word.rb