Project

xws

0.0
No commit activity in last 3 years
No release in over 3 years
XML Word Scanner (XWS) reads a Rexle document and returns a hash object containing each word found.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.3.9, ~> 1.3
>= 0.1.0, ~> 0.1
 Project Readme

Introducing the XML Word Scanner (XWS) gem

require 'xws'
require 'open-uri'

url = 'https://www.jamesrobertson.eu/liveblog/2015/nov/10/formatted.xml'
doc = Rexle.new(open(url).read)
nodes = doc.root.xpath 'records/section'

xws = XWS.new
h = xws.scan nodes[0].element('details')

output (extract):

=> {"gas"=>2, "fire"=>2, "is"=>3, "now"=>1, "working"=>2, "again"=>2, 
"#gasfire"=>1, "after"=>1, "drawn"=>1, "out"=>3, "affair"=>1, "of"=>3, 
"attempting"=>1, "to"=>2, "get"=>1, "work"=>1, "it"=>2, "fina...

Resources

xws word scanner xml search