-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c681094
Showing
6 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module Measure | ||
@count = 0 | ||
MAX_TASK_NAME_LEN = 30 | ||
|
||
def self.time( task_name, total = 1, &block ) | ||
@count += 1 | ||
header = "[ Run task #{task_number = @count} #{total} times ]" | ||
|
||
short_name = task_name[0..MAX_TASK_NAME_LEN] + ( task_name.length > MAX_TASK_NAME_LEN ? '...' : '' ) | ||
|
||
start_time = Time.now | ||
|
||
puts "#{header} Start '#{short_name}' at #{start_time.to_s.to_s.match(/\d+:\d+:\d+/)[0]}" | ||
|
||
1.upto(total) { | ||
block.call | ||
} | ||
|
||
end_time = Time.now | ||
|
||
puts "#{header} Spent #{(end_time - start_time).to_i} seconds on '#{short_name}'" | ||
end | ||
end |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require 'measure' | ||
require 'rjb' | ||
|
||
Rjb::load('stanford-postagger.jar:stanford-ner.jar', ['-Xmx200m']) | ||
|
||
CRFClassifier = Rjb::import('edu.stanford.nlp.ie.crf.CRFClassifier') | ||
classifier = CRFClassifier.getClassifierNoExceptions("ner-eng-ie.crf-4-conll.ser.gz") | ||
|
||
MaxentTagger = Rjb::import('edu.stanford.nlp.tagger.maxent.MaxentTagger') | ||
MaxentTagger.init("left3words-wsj-0-18.tagger") | ||
|
||
Sentence = Rjb::import('edu.stanford.nlp.ling.Sentence') | ||
|
||
sent = "Good afternoon Rajat Raina, how are you today?" | ||
|
||
Measure.time "NER", 10 do | ||
puts classifier.testString( sent ) | ||
puts MaxentTagger.tagString( sent ) | ||
end |
Binary file not shown.
Binary file not shown.