Sha256: 0ad45377250deff92684b74763f9fef58aba5936558a5891b224593835df33e4
Contents?: true
Size: 339 Bytes
Versions: 2
Compression:
Stored size: 339 Bytes
Contents
require "ruby-spacy" require "terminal-table" nlp = Spacy::Language.new("en_core_web_sm") doc = nlp.read("Autonomous cars shift insurance liability toward manufacturers") results = [] doc.each do |token| if token.dep_ == "nsubj" && token.head.pos_ == "VERB" results << token.head.text end end puts results.to_s # ["shift"]
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-spacy-0.1.4.1 | examples/linguistic_features/finding_a_verb_with_a_subject.rb |
ruby-spacy-0.1.4 | examples/linguistic_features/finding_a_verb_with_a_subject.rb |