Module: ArkTweetNlp::Parser

Defined in:
lib/ark_tweet_nlp/parser.rb

Constant Summary collapse

TAGSET =
{
  :N => 'common noun',
  :O => 'pronoun, non possessive',
  :^ => 'proper noun',
  :S => 'nominal + possessive',
  :Z => 'proper noun + possessive',
  :V => 'verb including copula, auxiliaries',
  :L => 'nominal + verbal (e.g. i’m), verbal + nominal (let’s)',
  :M => 'proper noun + verbal',
  :A => 'adjective',
  :R => 'adverb',
  :! => 'interjection',
  :D => 'determiner',
  :P => 'pre- or postposition, or subordinating conjunction',
  :& => 'coordinating conjunction',
  :T => 'verb particle',
  :X => 'existential there, predeterminers',
  :Y => 'X + verbal',
  :'#' => 'hashtag (indicates topic/category for tweet)',
  :'@' => 'at-mention (indicates a user as a recipient of a tweet)',
  :~ => 'discourse marker, indications of continuation across multiple tweets',
  :U => 'URL or email address',
  :E => 'emoticon',
  :'$' => 'numeral',
  :',' => 'punctuation',
  :G => 'other abbreviations, foreign words, possessive endings, symbols, garbage'
}
TAGGER_PATH =

spec = Gem::Specification.find_by_name(“ark_tweet_nlp”) gem_root = spec.gem_dir gem_bin = gem_root + “/bin”

File.join(Gem::Specification.find_by_name("ark_tweet_nlp").gem_dir, 'bin', 'runTagger.sh')

Class Method Summary collapse

Class Method Details

.find_tags(text) ⇒ Object



41
42
43
44
# File 'lib/ark_tweet_nlp/parser.rb', line 41

def Parser.find_tags text
  result = Parser.run_tagger(text)
  result.split("\n").map{ |line| Parser.convert_line( line ) }
end

.get_words_tagged_as(tagged_result, *tags) ⇒ Object



46
47
48
# File 'lib/ark_tweet_nlp/parser.rb', line 46

def Parser.get_words_tagged_as tagged_result, *tags
  Parser.merge_array( tagged_result.map{ |e| Parser.safe_invert( e ).select{ |key| tags.include? key } })
end

.olaObject



37
38
39
# File 'lib/ark_tweet_nlp/parser.rb', line 37

def Parser.ola
  "ola"
end