examples/japanese/named_entity_recognition.rb in ruby-spacy-0.1.4.1 vs examples/japanese/named_entity_recognition.rb in ruby-spacy-0.1.5.0

- old
+ new

@@ -1,14 +1,16 @@ +# frozen_string_literal: true + 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"] +headings = %w[text start end label] rows = [] doc.ents.each do |ent| rows << [ent.text, ent.start_char, ent.end_char, ent.label] end @@ -22,6 +24,5 @@ # | 任天堂 | 0 | 3 | ORG | # | 1983年 | 4 | 9 | DATE | # | ファミコン | 10 | 15 | PRODUCT | # | 14,800円 | 16 | 23 | MONEY | # +------------+-------+-----+---------+ -