phrasie 0.1.4 → 0.1.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.
@@ -6,5 +6,5 @@ require 'phrasie/tag'
6
6
  require 'phrasie/extractor'
7
7
 
8
8
  module Phrasie
9
- VERSION = '0.1.4'
9
+ VERSION = '0.1.5'
10
10
  end
@@ -1,8 +1,9 @@
1
- SEARCH = 0
2
- NOUN = 1
3
-
4
1
  module Phrasie
5
2
  class Extractor
3
+ # Simple state machine for use in the #phrases method.
4
+ SEARCH = 0
5
+ NOUN = 1
6
+
6
7
  attr_accessor :tagger, :filter
7
8
 
8
9
  def initialize(options={})
@@ -14,7 +15,8 @@ module Phrasie
14
15
  "#<Phrasie::Extractor>"
15
16
  end
16
17
 
17
- # Returns an array of [phrase, occurances, # of words in phrase]
18
+ # Returns an array of arrays in the format of:
19
+ # [phrase, # of occurances, # of words in phrase]
18
20
  def phrases(input, filter=nil)
19
21
  if input.is_a? String
20
22
  taggedTerms = self.tagger.tag(input)
@@ -33,8 +35,9 @@ module Phrasie
33
35
 
34
36
  terms = {}
35
37
  multiterm = []
38
+
36
39
  state = SEARCH
37
-
40
+
38
41
  while taggedTerms.size > 0
39
42
  term, tag, norm = taggedTerms.shift
40
43
  if state == SEARCH && tag[0,1] == "N"
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "phrasie"
3
- s.version = '0.1.4'
3
+ s.version = '0.1.5'
4
4
  s.authors = ["Ashley Williams"]
5
5
  s.email = ["hi@ashleyw.co.uk"]
6
6
  s.summary = "Determines important terms within a given piece of content."
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 5
9
+ version: 0.1.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ashley Williams
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-17 00:00:00 +00:00
17
+ date: 2011-01-19 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies: []
20
20