quickcite 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +6 -0
- data/Gemfile.lock +29 -0
- data/Rakefile +12 -0
- data/bin/quickcite +17 -0
- data/lib/quickcite.rb +93 -0
- data/lib/quickcite/citeulike.rb +29 -0
- data/lib/quickcite/dblp.rb +49 -0
- data/lib/quickcite/json.rb +46 -0
- data/lib/quickcite/version.rb +3 -0
- data/quickcite.gemspec +16 -0
- data/test/dean.html +18 -0
- data/test/power-piccolo.html +31 -0
- data/test/power-piccolo.json +91 -0
- data/test/test_quickcite.rb +45 -0
- metadata +120 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
quickcite (1.0.0)
|
5
|
+
bibtex-ruby (>= 2.0)
|
6
|
+
json
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
bibtex-ruby (2.0.12)
|
12
|
+
latex-decode (>= 0.0.6)
|
13
|
+
multi_json (~> 1.3)
|
14
|
+
highline (1.6.13)
|
15
|
+
json (1.7.3)
|
16
|
+
latex-decode (0.0.12)
|
17
|
+
unicode (~> 0.4)
|
18
|
+
multi_json (1.3.6)
|
19
|
+
nokogiri (1.5.5)
|
20
|
+
unicode (0.4.2)
|
21
|
+
|
22
|
+
PLATFORMS
|
23
|
+
ruby
|
24
|
+
|
25
|
+
DEPENDENCIES
|
26
|
+
bundler
|
27
|
+
highline
|
28
|
+
nokogiri
|
29
|
+
quickcite!
|
data/Rakefile
ADDED
data/bin/quickcite
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'quickcite'
|
4
|
+
|
5
|
+
flags = {}
|
6
|
+
optparse = OptionParser.new do|opts|
|
7
|
+
opts.banner = "Usage: quickrite -b <bibtex file> latex1 latex2 ... "
|
8
|
+
|
9
|
+
flags[:bibtex] = nil
|
10
|
+
opts.on( '-b', '--bibtex FILE', 'Extract/generate references to FILE' ) do|file|
|
11
|
+
flags[:bibtex] = file
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
optparse.parse!
|
16
|
+
|
17
|
+
QuickCite::run(ARGV, flags[:bibtex])
|
data/lib/quickcite.rb
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "rubygems"
|
4
|
+
require "bundler/setup"
|
5
|
+
|
6
|
+
require "highline/system_extensions"
|
7
|
+
require "bibtex"
|
8
|
+
require "optparse"
|
9
|
+
require "readline"
|
10
|
+
require "quickcite/citeulike"
|
11
|
+
require "quickcite/dblp"
|
12
|
+
|
13
|
+
module QuickCite
|
14
|
+
CITE_REGEX = /\\cite\{([^\}]+)\}/
|
15
|
+
SPLIT_REGEX = /([A-Z]+[a-z]+|[0-9]+|[^\\p]+)/
|
16
|
+
|
17
|
+
# Convert a citation reference (e.g "PowerPiccolo2008") into a
|
18
|
+
# list of strings appropriate for submission to a search engine.
|
19
|
+
#
|
20
|
+
# By default the citation is split on lowercase->uppercase transitions.
|
21
|
+
def self.cite_to_query(cite)
|
22
|
+
cite.scan(SPLIT_REGEX).map { |w| w[0] }
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.ask_user(cite, result_list)
|
26
|
+
puts "Result to use for \{#{cite}\}: "
|
27
|
+
puts " (0) Skip this citation"
|
28
|
+
result_list.each_with_index do |r, idx|
|
29
|
+
puts " (#{idx + 1}) #{r.title}"
|
30
|
+
puts " #{r.authors.join(', ')}"
|
31
|
+
end
|
32
|
+
|
33
|
+
c = HighLine::SystemExtensions::get_character.chr.to_i
|
34
|
+
if c > 0 && c <= result_list.length then
|
35
|
+
return result_list[c - 1]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class Main
|
40
|
+
include QuickCite
|
41
|
+
def initialize(latex_files, bibtex_file)
|
42
|
+
@source = DBLP.new
|
43
|
+
@bib = BibTeX.open(bibtex_file, :include => [:meta_content])
|
44
|
+
|
45
|
+
latex_files.each do|f|
|
46
|
+
puts("Processing... #{f}")
|
47
|
+
process_latex(f)
|
48
|
+
end
|
49
|
+
|
50
|
+
puts("Writing bibtex...")
|
51
|
+
outfile = open(bibtex_file, "w")
|
52
|
+
outfile.write(@bib.to_s)
|
53
|
+
outfile.close
|
54
|
+
end
|
55
|
+
|
56
|
+
def update_bibtex(cite, entry)
|
57
|
+
e = BibTeX.parse(@source.bibtex(entry)).first
|
58
|
+
e.key = cite
|
59
|
+
@bib << e
|
60
|
+
end
|
61
|
+
|
62
|
+
def process_cite(cite)
|
63
|
+
if @bib.has_key?(cite) then
|
64
|
+
puts("Skipping matched reference #{cite}")
|
65
|
+
else
|
66
|
+
puts("Missing reference for #{cite}")
|
67
|
+
query = QuickCite.cite_to_query(cite)
|
68
|
+
results = @source.search(query)
|
69
|
+
accepted = QuickCite.ask_user(cite, results)
|
70
|
+
if accepted == nil
|
71
|
+
puts "Skipping update for reference #{cite}"
|
72
|
+
else
|
73
|
+
puts "Updating bibtex for #{cite} with result: \n#{accepted.title}"
|
74
|
+
update_bibtex(cite, accepted)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def process_latex(f)
|
80
|
+
latex = File.read(f)
|
81
|
+
latex.scan(CITE_REGEX) do|m|
|
82
|
+
m[0].split(",").map do|c|
|
83
|
+
process_cite(c)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
puts(f)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.run(latex_files, bibtex_file)
|
91
|
+
Main.new(latex_files, bibtex_file)
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Searches and downloads bibtex entries from CiteULike (citeulike.org)
|
4
|
+
#
|
5
|
+
# Author:: Russell Power (power@cs.nyu.edu)
|
6
|
+
|
7
|
+
require "net/http"
|
8
|
+
require "uri"
|
9
|
+
require "quickcite/json"
|
10
|
+
|
11
|
+
module QuickCite
|
12
|
+
class CiteULike
|
13
|
+
HOST = "http://www.citeulike.org"
|
14
|
+
SEARCH_BASE = "/json/search/all"
|
15
|
+
BIBTEX_OPTIONS = "do_username_prefix=0&key_type=4&incl_amazon=1&clean_urls=1&smart_wrap=1&q="
|
16
|
+
|
17
|
+
def search(query)
|
18
|
+
http = Net::HTTP.new(HOST)
|
19
|
+
request = Net::HTTP::Get.new(SEARCH_BASE)
|
20
|
+
request.set_form_data({ "q" => query })
|
21
|
+
response = http.request(request)
|
22
|
+
js = JSONUtil.Parse(response.body)
|
23
|
+
return js
|
24
|
+
end
|
25
|
+
|
26
|
+
def bibtex(identifier)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Searches and downloads bibtex entries from CiteULike (citeulike.org)
|
4
|
+
#
|
5
|
+
# Author:: Russell Power (power@cs.nyu.edu)
|
6
|
+
|
7
|
+
require "net/http"
|
8
|
+
require "nokogiri"
|
9
|
+
require "quickcite/json"
|
10
|
+
require "uri"
|
11
|
+
|
12
|
+
module QuickCite
|
13
|
+
class DBLP
|
14
|
+
# NB -- DBLP seems to expect query arguments in a certain order -
|
15
|
+
# the q= argument has to come first.
|
16
|
+
SEARCH_BASE = "http://www.dblp.org/search/api/?"
|
17
|
+
SEARCH_SUFFIX = "&c=4&f=0&format=json&h=10"
|
18
|
+
|
19
|
+
Result = Struct.new("Result", :title, :authors, :url)
|
20
|
+
def search(query)
|
21
|
+
# json = JSONUtil.parse(File.read("test/power-piccolo.json"))
|
22
|
+
query_str = "q=" + URI::escape(query.join(" "))
|
23
|
+
uri = URI::parse(SEARCH_BASE + query_str + SEARCH_SUFFIX)
|
24
|
+
|
25
|
+
response = Net::HTTP::get(uri)
|
26
|
+
json = JSONUtil.parse(response)
|
27
|
+
|
28
|
+
json.result.hits.hit.map do |h|
|
29
|
+
Result.new(
|
30
|
+
h.title["dblp:title"].text,
|
31
|
+
h.title["dblp:authors"]["dblp:author"].to_a,
|
32
|
+
h.url)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def bibtex(result)
|
37
|
+
# dom = Nokogiri.Slop(open("test/power-piccolo.html"))
|
38
|
+
puts("RESULT #{result.url}")
|
39
|
+
dom = Nokogiri.Slop Net::HTTP.get(URI::parse(result.url))
|
40
|
+
entries = dom.html.body.pre
|
41
|
+
case entries
|
42
|
+
when Nokogiri::XML::NodeSet
|
43
|
+
return entries[0].to_str
|
44
|
+
else
|
45
|
+
return entries.to_str
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# JSON utilities.
|
2
|
+
require "json"
|
3
|
+
|
4
|
+
module QuickCite
|
5
|
+
module JSONUtil
|
6
|
+
class JSONDict
|
7
|
+
extend Forwardable
|
8
|
+
include Enumerable
|
9
|
+
attr_reader :dict
|
10
|
+
|
11
|
+
def initialize(d)
|
12
|
+
@dict = d
|
13
|
+
end
|
14
|
+
|
15
|
+
def method_missing name, *args
|
16
|
+
return JSONUtil._wrap(@dict[name.to_s])
|
17
|
+
end
|
18
|
+
|
19
|
+
def [](key)
|
20
|
+
JSONUtil._wrap(@dict[key])
|
21
|
+
end
|
22
|
+
|
23
|
+
def each
|
24
|
+
case @dict
|
25
|
+
when Hash
|
26
|
+
@dict.each_key { |k| yield self[k] }
|
27
|
+
when Array
|
28
|
+
@dict.each_index { |k| yield self[k] }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def self._wrap(value)
|
34
|
+
case value
|
35
|
+
when Hash, Array
|
36
|
+
JSONDict.new(value)
|
37
|
+
else
|
38
|
+
value
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.parse(str)
|
43
|
+
d = JSONDict.new(JSON.parse(str))
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/quickcite.gemspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.expand_path("../lib/quickcite/version", __FILE__)
|
2
|
+
|
3
|
+
spec = Gem::Specification.new do |s|
|
4
|
+
s.platform = Gem::Platform::RUBY
|
5
|
+
s.summary = "Efficient citation lookup and management"
|
6
|
+
s.name = "quickcite"
|
7
|
+
s.authors = ["Russell Power"]
|
8
|
+
s.version = QuickCite::VERSION
|
9
|
+
s.email = "power@cs.nyu.edu"
|
10
|
+
s.require_path = "lib"
|
11
|
+
s.files = `git ls-files`.split("\n")
|
12
|
+
|
13
|
+
s.add_dependency "bibtex-ruby", ">=2.0"
|
14
|
+
s.add_dependency "json"
|
15
|
+
s.add_development_dependency "bundler"
|
16
|
+
end
|
data/test/dean.html
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
<html><head><title>DBLP BibTeX Record 'journals/cacm/DeanG10'</title><link href="http://dblp.uni-trier.de/dblp.css" rel="stylesheet" type="text/css" /></head><body>
|
2
|
+
<table width="100%"><tr><td align="left"><a href="http://dblp.uni-trier.de/db/index.html"><img alt="dblp.uni-trier.de" src="http://dblp.uni-trier.de/db/Logo.gif" border="0" height="60" width="170"/></a></td><td align="center"><a href="http://www.dagstuhl.de/"><img alt="www.dagstuhl.de" src="http://dblp.uni-trier.de/db/lzi_logo.gif" border="0" height="56" width="251"/></a></td><td align="right"><a href="http://www.uni-trier.de"><img alt="www.uni-trier.de" src="http://dblp.uni-trier.de/db/logo_universitaet-trier.gif" border="0" height="48" width="215"/></a></td></tr></table>
|
3
|
+
<h1>DBLP BibTeX Record '<a href="http://dblp.uni-trier.de/rec/bibtex/journals/cacm/DeanG10.xml">journals/cacm/DeanG10</a>'</h1>
|
4
|
+
<pre>@article{<a href="http://dblp.uni-trier.de/db/about/bibtex.html">DBLP</a>:journals/cacm/DeanG10,
|
5
|
+
author = {Jeffrey Dean and
|
6
|
+
Sanjay Ghemawat},
|
7
|
+
title = {MapReduce: a flexible data processing tool},
|
8
|
+
journal = {Commun. ACM},
|
9
|
+
volume = {53},
|
10
|
+
number = {1},
|
11
|
+
year = {2010},
|
12
|
+
pages = {72-77},
|
13
|
+
ee = {http://doi.acm.org/10.1145/1629175.1629198},
|
14
|
+
bibsource = {DBLP, http://dblp.uni-trier.de}
|
15
|
+
}
|
16
|
+
</pre>
|
17
|
+
<p><div class="footer"><a href="http://dblp.uni-trier.de/db/index.html">Home</a> | <a href="http://dblp.uni-trier.de/db/conf/indexa.html">Conferences</a> | <a href="http://dblp.uni-trier.de/db/journals/index.html">Journals</a> | <a href="http://dblp.uni-trier.de/db/series/index.html">Series</a> | <a href="http://dblp.uni-trier.de/db/about/faq.html">FAQ</a> — Search: <a href="http://dblp.l3s.de">Faceted</a> | <a href="http://dblp.isearch-it-solutions.net/"> Free</a> | <a href="http://www.dblp.org/search/">Complete</a> | <a href="http://dblp.uni-trier.de/db/indices/a-tree/index.html">Author</a></div>
|
18
|
+
<small>Last update 2005-12-16 CET by the <a href="http://dblp.uni-trier.de/db/about/team.html">DBLP Team</a> — <a href="http://opendefinition.org/"><img alt="This material is Open Data" border="0" src="http://assets.okfn.org/images/ok_buttons/od_80x15_blue.png" style="position:relative; top:3px" /></a> Data released under the <a href="http://opendatacommons.org/licenses/by/summary/">ODC-BY 1.0 license</a> — See also our <a href="http://dblp.uni-trier.de/db/copyright.html">legal information page</a></small></p></body></html>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<html><head><title>DBLP BibTeX Record 'conf/osdi/PowerL10'</title><link href="http://dblp.uni-trier.de/dblp.css" rel="stylesheet" type="text/css" /></head><body>
|
2
|
+
<table width="100%"><tr><td align="left"><a href="http://dblp.uni-trier.de/db/index.html"><img alt="dblp.uni-trier.de" src="http://dblp.uni-trier.de/db/Logo.gif" border="0" height="60" width="170"/></a></td><td align="center"><a href="http://www.dagstuhl.de/"><img alt="www.dagstuhl.de" src="http://dblp.uni-trier.de/db/lzi_logo.gif" border="0" height="56" width="251"/></a></td><td align="right"><a href="http://www.uni-trier.de"><img alt="www.uni-trier.de" src="http://dblp.uni-trier.de/db/logo_universitaet-trier.gif" border="0" height="48" width="215"/></a></td></tr></table>
|
3
|
+
<h1>DBLP BibTeX Record '<a href="http://dblp.uni-trier.de/rec/bibtex/conf/osdi/PowerL10.xml">conf/osdi/PowerL10</a>'</h1>
|
4
|
+
<pre>@inproceedings{<a href="http://dblp.uni-trier.de/db/about/bibtex.html">DBLP</a>:conf/osdi/PowerL10,
|
5
|
+
author = {Russell Power and
|
6
|
+
Jinyang Li},
|
7
|
+
title = {Piccolo: Building Fast, Distributed Programs with Partitioned
|
8
|
+
Tables},
|
9
|
+
booktitle = {OSDI},
|
10
|
+
year = {2010},
|
11
|
+
pages = {293-306},
|
12
|
+
ee = {http://www.usenix.org/events/osdi10/tech/full_papers/Power.pdf},
|
13
|
+
crossref = {DBLP:conf/osdi/2010},
|
14
|
+
bibsource = {DBLP, http://dblp.uni-trier.de}
|
15
|
+
}
|
16
|
+
</pre>
|
17
|
+
<pre>@proceedings{<a href="http://dblp.uni-trier.de/db/about/bibtex.html">DBLP</a>:conf/osdi/2010,
|
18
|
+
editor = {Remzi H. Arpaci-Dusseau and
|
19
|
+
Brad Chen},
|
20
|
+
title = {9th USENIX Symposium on Operating Systems Design and Implementation,
|
21
|
+
OSDI 2010, October 4-6, 2010, Vancouver, BC, Canada, Proceedings},
|
22
|
+
booktitle = {OSDI},
|
23
|
+
publisher = {USENIX Association},
|
24
|
+
year = {2010},
|
25
|
+
isbn = {978-1-931971-79-9},
|
26
|
+
ee = {http://www.usenix.org/event/osdi10/tech/full_papers/osdi10_proceedings.pdf},
|
27
|
+
bibsource = {DBLP, http://dblp.uni-trier.de}
|
28
|
+
}
|
29
|
+
</pre>
|
30
|
+
<p><div class="footer"><a href="http://dblp.uni-trier.de/db/index.html">Home</a> | <a href="http://dblp.uni-trier.de/db/conf/indexa.html">Conferences</a> | <a href="http://dblp.uni-trier.de/db/journals/index.html">Journals</a> | <a href="http://dblp.uni-trier.de/db/series/index.html">Series</a> | <a href="http://dblp.uni-trier.de/db/about/faq.html">FAQ</a> — Search: <a href="http://dblp.l3s.de">Faceted</a> | <a href="http://dblp.isearch-it-solutions.net/"> Free</a> | <a href="http://www.dblp.org/search/">Complete</a> | <a href="http://dblp.uni-trier.de/db/indices/a-tree/index.html">Author</a></div>
|
31
|
+
<small>Last update 2009-06-09 CET by the <a href="http://dblp.uni-trier.de/db/about/team.html">DBLP Team</a> — <a href="http://opendefinition.org/"><img alt="This material is Open Data" border="0" src="http://assets.okfn.org/images/ok_buttons/od_80x15_blue.png" style="position:relative; top:3px" /></a> Data released under the <a href="http://opendatacommons.org/licenses/by/summary/">ODC-BY 1.0 license</a> — See also our <a href="http://dblp.uni-trier.de/db/copyright.html">legal information page</a></small></p></body></html>
|
@@ -0,0 +1,91 @@
|
|
1
|
+
{
|
2
|
+
"result":{
|
3
|
+
"query":"power* piccolo*",
|
4
|
+
"status":
|
5
|
+
{
|
6
|
+
"@code":12,"text":"OK"
|
7
|
+
},
|
8
|
+
"time":{
|
9
|
+
"@unit":"msecs",
|
10
|
+
"text":4.96
|
11
|
+
},
|
12
|
+
"completions":{
|
13
|
+
"@total":1,
|
14
|
+
"@computed":1,
|
15
|
+
"@sent":1,
|
16
|
+
"c":{
|
17
|
+
"@sc":202,
|
18
|
+
"@dc":3,
|
19
|
+
"@oc":3,
|
20
|
+
"@id":11535429,
|
21
|
+
"text":"piccolo"
|
22
|
+
}
|
23
|
+
},
|
24
|
+
"hits":{
|
25
|
+
"@total":3,
|
26
|
+
"@computed":3,
|
27
|
+
"@sent":3,
|
28
|
+
"@first":0,
|
29
|
+
"hit":[
|
30
|
+
{
|
31
|
+
"@score":102,
|
32
|
+
"@id":1287205,
|
33
|
+
"title":{
|
34
|
+
"dblp:authors":{
|
35
|
+
"dblp:author":[
|
36
|
+
"Geev Mokryani",
|
37
|
+
"Pierluigi Siano",
|
38
|
+
"Antonio Piccolo",
|
39
|
+
"Vito Calderaro",
|
40
|
+
"Carlo Cecati"]},
|
41
|
+
"dblp:title":{
|
42
|
+
"@ee":"http://doi.ieeecomputersociety.org/10.1109/FUZZY.2011.6007591",
|
43
|
+
"text":"A novel fuzzy system for wind turbines reactive power control. "},
|
44
|
+
"dblp:venue":{
|
45
|
+
"@url":"db/conf/fuzzIEEE/fuzzIEEE2011.html#MokryaniSPCC11",
|
46
|
+
"text":"FUZZ-IEEE 2011:231-235"},
|
47
|
+
"dblp:year":2011,
|
48
|
+
"dblp:type":"inproceedings"},
|
49
|
+
"url":"http://www.dblp.org/rec/bibtex/conf/fuzzIEEE/MokryaniSPCC11"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"@score":102,
|
53
|
+
"@id":1565069,
|
54
|
+
"title":{
|
55
|
+
"dblp:authors":{
|
56
|
+
"dblp:author":[
|
57
|
+
"Russell Power",
|
58
|
+
"Jinyang Li"]},
|
59
|
+
"dblp:title":{
|
60
|
+
"@ee":"http://www.usenix.org/events/osdi10/tech/full_papers/Power.pdf",
|
61
|
+
"text":"Piccolo: Building Fast, Distributed Programs with Partitioned Tables. "},
|
62
|
+
"dblp:venue":{
|
63
|
+
"@url":"db/conf/osdi/osdi2010.html#PowerL10",
|
64
|
+
"text":"OSDI 2010:293-306"},
|
65
|
+
"dblp:year":2010,
|
66
|
+
"dblp:type":"inproceedings"},
|
67
|
+
"url":"http://www.dblp.org/rec/bibtex/conf/osdi/PowerL10"
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"@score":102,
|
71
|
+
"@id":2042841,
|
72
|
+
"title":{
|
73
|
+
"dblp:authors":{
|
74
|
+
"dblp:author":[
|
75
|
+
"Giuseppe Bianchi",
|
76
|
+
"Nicola Blefari-Melazzi",
|
77
|
+
"Francesca Lo Piccolo"]},
|
78
|
+
"dblp:title":{
|
79
|
+
"@ee":"http://dx.doi.org/10.1109/ISCC.2007.4381640",
|
80
|
+
"text":"Impact of Chosen Error Criteria in RSS-based Localization: Power vs Distance vs Relative Distance Error Minimization. "},
|
81
|
+
"dblp:venue":{
|
82
|
+
"@url":"db/conf/iscc/iscc2007.html#BianchiBP07",
|
83
|
+
"text":"ISCC 2007"},
|
84
|
+
"dblp:year":2007,
|
85
|
+
"dblp:type":"inproceedings"},
|
86
|
+
"url":"http://www.dblp.org/rec/bibtex/conf/iscc/BianchiBP07"
|
87
|
+
}
|
88
|
+
]
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "quickcite"
|
4
|
+
require "quickcite/json"
|
5
|
+
|
6
|
+
require "test/unit"
|
7
|
+
|
8
|
+
class TestJson < Test::Unit::TestCase
|
9
|
+
def test_simple()
|
10
|
+
v = QuickCite::JSONUtil.parse(File.read('test/power-piccolo.json'))
|
11
|
+
v.result.hits.hit.map { |h| puts(h.url) }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class TestMain < Test::Unit::TestCase
|
16
|
+
def test_simple()
|
17
|
+
texfile = open("/tmp/test.tex", "w")
|
18
|
+
texfile.write <<-END
|
19
|
+
This is a test latex file.
|
20
|
+
I like to cite \\cite{PowerPiccolo}
|
21
|
+
And \\cite{MapreduceDean}
|
22
|
+
END
|
23
|
+
texfile.close
|
24
|
+
|
25
|
+
bibfile = open("/tmp/test.bib", "w")
|
26
|
+
bibfile.write("")
|
27
|
+
bibfile.close
|
28
|
+
|
29
|
+
QuickCite::run(["/tmp/test.tex"], "/tmp/test.bib")
|
30
|
+
|
31
|
+
puts("Result: ")
|
32
|
+
puts(File.read("/tmp/test.bib"))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class TestCiteToQuery < Test::Unit::TestCase
|
37
|
+
def test_simple()
|
38
|
+
assert_equal(
|
39
|
+
["Russell", "Power", "Piccolo"],
|
40
|
+
QuickCite::cite_to_query("RussellPowerPiccolo"))
|
41
|
+
assert_equal(
|
42
|
+
["Piccolo", "2010"],
|
43
|
+
QuickCite::cite_to_query("Piccolo2010"))
|
44
|
+
end
|
45
|
+
end
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: quickcite
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Russell Power
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-07-18 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: bibtex-ruby
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 2
|
31
|
+
- 0
|
32
|
+
version: "2.0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: json
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: bundler
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :development
|
62
|
+
version_requirements: *id003
|
63
|
+
description:
|
64
|
+
email: power@cs.nyu.edu
|
65
|
+
executables: []
|
66
|
+
|
67
|
+
extensions: []
|
68
|
+
|
69
|
+
extra_rdoc_files: []
|
70
|
+
|
71
|
+
files:
|
72
|
+
- Gemfile
|
73
|
+
- Gemfile.lock
|
74
|
+
- Rakefile
|
75
|
+
- bin/quickcite
|
76
|
+
- lib/quickcite.rb
|
77
|
+
- lib/quickcite/citeulike.rb
|
78
|
+
- lib/quickcite/dblp.rb
|
79
|
+
- lib/quickcite/json.rb
|
80
|
+
- lib/quickcite/version.rb
|
81
|
+
- quickcite.gemspec
|
82
|
+
- test/dean.html
|
83
|
+
- test/power-piccolo.html
|
84
|
+
- test/power-piccolo.json
|
85
|
+
- test/test_quickcite.rb
|
86
|
+
homepage:
|
87
|
+
licenses: []
|
88
|
+
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
version: "0"
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
hash: 3
|
109
|
+
segments:
|
110
|
+
- 0
|
111
|
+
version: "0"
|
112
|
+
requirements: []
|
113
|
+
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 1.8.15
|
116
|
+
signing_key:
|
117
|
+
specification_version: 3
|
118
|
+
summary: Efficient citation lookup and management
|
119
|
+
test_files: []
|
120
|
+
|