Sha256: e6e267d4aee8c5fe21bbe5583fccc175602a9a701ce7bc8432107ffeba2ce213
Contents?: true
Size: 756 Bytes
Versions: 2
Compression:
Stored size: 756 Bytes
Contents
require "ruby-spacy" require "terminal-table" nlp = Spacy::Language.new("ja_core_news_lg") sentence = "任天堂は1983年にファミコンを14,800円で発売した。" doc = nlp.read(sentence) headings = ["text", "start", "end", "label"] rows = [] doc.ents.each do |ent| rows << [ent.text, ent.start_char, ent.end_char, ent.label] end table = Terminal::Table.new rows: rows, headings: headings puts table # +------------+-------+-----+---------+ # | text | start | end | label | # +------------+-------+-----+---------+ # | 任天堂 | 0 | 3 | ORG | # | 1983年 | 4 | 9 | DATE | # | ファミコン | 10 | 15 | PRODUCT | # | 14,800円 | 16 | 23 | MONEY | # +------------+-------+-----+---------+
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-spacy-0.1.4.1 | examples/japanese/named_entity_recognition.rb |
ruby-spacy-0.1.4 | examples/japanese/named_entity_recognition.rb |