Sha256: 751b3879a75696c04cb9d3dfa9bc1c0d6ee840102f889b40ea68f7fb3f9d774d

Contents?: true

Size: 735 Bytes

Versions: 2

Compression:

Stored size: 735 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

2 entries across 2 versions & 1 rubygems

Version Path
ruby-spacy-0.1.4.1 examples/get_started/named_entities.rb
ruby-spacy-0.1.4 examples/get_started/named_entities.rb