Sha256: 8142a153a35c6a361c066f9b7f7de688e25fcc6eb074726e48a65036a794986e
Contents?: true
Size: 790 Bytes
Versions: 4
Compression:
Stored size: 790 Bytes
Contents
require "ruby-spacy" require "terminal-table" nlp = Spacy::Language.new("ja_core_news_lg") doc = nlp.read("自動運転車は保険責任を製造者に転嫁する。") headings = ["text", "root.text", "root.dep", "root.head.text"] rows = [] doc.noun_chunks.each do |chunk| rows << [chunk.text, chunk.root.text, chunk.root.dep_, chunk.root.head.text] end table = Terminal::Table.new rows: rows, headings: headings puts table # +------------+-----------+----------+----------------+ # | text | root.text | root.dep | root.head.text | # +------------+-----------+----------+----------------+ # | 自動運転車 | 車 | nsubj | 転嫁 | # | 製造者 | 者 | obl | 転嫁 | # +------------+-----------+----------+----------------+
Version data entries
4 entries across 4 versions & 1 rubygems