Sha256: 570d9bddc73d69e92faad59a2d12605098548c3c6bacf63730dd09eb1dc36ed7
Contents?: true
Size: 676 Bytes
Versions: 2
Compression:
Stored size: 676 Bytes
Contents
require "ruby-spacy" require "terminal-table" nlp = Spacy::Language.new("en_core_web_sm") sentence = "Apple is looking at buying U.K. startup for $1 billion" 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 | # +------------+-------+-----+-------+ # | 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/linguistic_features/named_entity_recognition.rb |
ruby-spacy-0.1.4 | examples/linguistic_features/named_entity_recognition.rb |