Sha256: 86a0ef16569e9cd2c29cd2f9fa5a33085aef4e4556998e48dea7ea79cf4a70ac
Contents?: true
Size: 736 Bytes
Versions: 4
Compression:
Stored size: 736 Bytes
Contents
require "ruby-spacy" require "terminal-table" nlp = Spacy::Language.new("en_core_web_sm") doc =nlp.read("Apple is looking at buying U.K. startup for $1 billion") headings = ["text", "start_char", "end_char", "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_char | end_char | label | # +------------+------------+----------+-------+ # | Apple | 0 | 5 | ORG | # | U.K. | 27 | 31 | GPE | # | $1 billion | 44 | 54 | MONEY | # +------------+------------+----------+-------+
Version data entries
4 entries across 4 versions & 1 rubygems