/citesight

Extracts and reports on citations in an academic text

Primary LanguageRubyMIT LicenseMIT

citesight

Gem Version Build Status

home: https://github.com/soumyaray/citesight Gem to extract and report on citations in an academic text

Usage

This gem may be used as a command line utility or called from code

CLI

citesight mydoc.txt

Code example

require 'citesight'
require 'pp'

contents = File.read("spec/testfiles/large_test.txt", :encoding => "UTF-8")
paper = PaperCitations.new(contents)
cites = paper.unique_cites

puts "\nTotal unique citations: #{cites.count}"
PP.pp(Hash[cites])

top_cite = cites.sort_by { |_c, count| count}.reverse.first[0]
puts "\nYour top citation: #{top_cite}"

top_cite_indexes = paper.index_of_cite(top_cite)
puts "It was cited at locations: #{top_cite_indexes.join(', ')}"