Sha256: d057dffb8a8bdb4bb190d8adf3e9439c39d916d23c92203a26754c11d10d9424
Contents?: true
Size: 847 Bytes
Versions: 2
Compression:
Stored size: 847 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", "pos", "dep"] rows = [] doc.each do |token| rows << [token.text, token.pos, token.dep] end table = Terminal::Table.new rows: rows, headings: headings puts table # +---------+-------+----------+ # | text | pos | dep | # +---------+-------+----------+ # | Apple | PROPN | nsubj | # | is | AUX | aux | # | looking | VERB | ROOT | # | at | ADP | prep | # | buying | VERB | pcomp | # | U.K. | PROPN | dobj | # | startup | NOUN | advcl | # | for | ADP | prep | # | $ | SYM | quantmod | # | 1 | NUM | compound | # | billion | NUM | pobj | # +---------+-------+----------+
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-spacy-0.1.4.1 | examples/get_started/linguistic_annotations.rb |
ruby-spacy-0.1.4 | examples/get_started/linguistic_annotations.rb |