Sha256: 67c9680397e152d8aaa263f031570ffcec497a4b9dd42c5540dbf2b043b43eda
Contents?: true
Size: 460 Bytes
Versions: 2
Compression:
Stored size: 460 Bytes
Contents
# frozen_string_literal: true # add path to ruby-spacy lib to load path $LOAD_PATH.unshift(File.expand_path("../../lib", __dir__)) 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| results << token.head.text if token.dep_ == "nsubj" && token.head.pos_ == "VERB" end puts results.to_s # ["shift"]
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-spacy-0.2.3 | examples/linguistic_features/finding_a_verb_with_a_subject.rb |
ruby-spacy-0.2.2 | examples/linguistic_features/finding_a_verb_with_a_subject.rb |