Skip to content

Rake class rewrite + improved functionality - #1

Open
pmbaumgartner wants to merge 10 commits into
fabianvf:developfrom
pmbaumgartner:master
Open

Rake class rewrite + improved functionality#1
pmbaumgartner wants to merge 10 commits into
fabianvf:developfrom
pmbaumgartner:master

Conversation

@pmbaumgartner

Copy link
Copy Markdown
  • Complete rewrite of the Rake class.
    • Cleaned up code by using tools from python's collections lib (Counter and defaultdict)
    • Methods now exist inside the Rake class, no need for them to be exposed outside (though they can still be called if need be
    • Rewrote the existing string tokenizer based on the process listed in the original paper (ie. "First, the document text is split into an array of words by the specified word delimiters. This array is then split into sequences of contiguous words at phrase delimiters and stop word positions.")
    • Uses the fox stopword list by default, since it returns results more similar to the abstract used as an example in the original paper, and the smart stopword list is overkill
    • Rake.run() can now take a tokenized list of words as input for alternative tokenizer use
    • Rake.run() now returns a sorted list of namedtuple KeywordScores, sorted by overall score and also containing sum_deg and sum_freq metrics. These can also be accessed via the Rake.keyword_scores attribute after a call to Rake.run()
    • Rake.word_scores is a class attribute that returns a sorted list of namedtuple WordScores, sorted by overall score and containing deg and freq metrics, available after calling Rake.run()
  • Package should be almost ready to install from pypi or github

@fabianvf

Copy link
Copy Markdown
Owner

Excellent! I'm a little short on time at the moment, but I'll try to dig into this in the next few days

@pmbaumgartner

Copy link
Copy Markdown
Author

No worries, I'm not in any rush, just curious to see your feedback. Enjoy your holiday(s)!

@fabianvf

Copy link
Copy Markdown
Owner

Wow, sorry, time got away from me. Just finished a job switch, and moving this weekend. I promise I haven't forgotten about this, just been a little short on time recently!

@pmbaumgartner

Copy link
Copy Markdown
Author

No problem, hope you'll be settling down soon. I haven't made any changes since the PR.

Comment thread rake/rake.py Outdated
# continue

punct_suffix = word[-1] in self.phrase_delimiters
punct_prefix = word[0] in self.phrase_delimiters

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing here looks off, can you run this through flake8 or something?

@fabianvf

fabianvf commented Feb 5, 2016

Copy link
Copy Markdown
Owner

Yeah, run this through flake8 and get those changes in, but it looks good to me. Have you had any luck updating the tests to use your new structure?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants