Method: Excite::TokenFeatures#punct

Defined in:
lib/excite/token_features.rb

#punct(toks, idx, author_names = nil) ⇒ Object



156
157
158
159
160
161
# File 'lib/excite/token_features.rb', line 156

def punct(toks, idx, author_names=nil)
  (toks[idx].raw =~ /\-.*\-/)              ? "multiHyphen" :
  (toks[idx].raw =~ /[[:alpha:]].*\-$/)    ? "truncated"   :
  (toks[idx].raw =~ /[[:alpha:]].*\.$/)    ? "abbrev"      :
  (toks[idx].np != toks[idx].raw)          ? "hasPunct"    : "others"
end