Skip to content
Brooke M. Fujita edited this page Feb 12, 2015 · 1 revision

Appendix C: Node Parsing and stat

When parsing nodes, natto.MeCabNode will have a stat (status) value per the following:

  • 0 - normal node defined in the dictionary
  • 1 - unknown node not defined in the dictionary
  • 3 - virtual node representing the end of a sentence

An example:

from natto import MeCab

nm = MeCab.new()

for n in nm.parse('ブルザエモンはいったい何者だ?', as_nodes=True):
    print('{}, {}'.format(n.surface, n.stat))
...

ブルザエモン, 1  # this noun is made-up, you won't find this in any dictionary!
は, 0              
いったい, 0
何者, 0
だ, 0
?, 0
, 3             # end of sentence 

Previous | Home | Next

Clone this wiki locally