Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

first commit

  • Loading branch information...
commit c6810945eb27e1133784a068339cf7d77c94aa0a 0 parents
@tiendung authored
BIN  left3words-wsj-0-18.tagger
Binary file not shown
23 measure.rb
@@ -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
BIN  ner-eng-ie.crf-4-conll.ser.gz
Binary file not shown
19 nlp.rb
@@ -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
BIN  stanford-ner.jar
Binary file not shown
BIN  stanford-postagger.jar
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.